Skip to content

Commit

Permalink
wip: connecting the proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed Oct 24, 2024
1 parent 24c9ee3 commit 31b525e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ public class AdvancedPortalsBungeePlugin extends Plugin {
public void onEnable() {
this.proxyCore = new AdvancedPortalsProxyCore(new BungeeInfoLogger(this), new BungeeProxyContainer(this));
this.proxyCore.onEnable();
getProxy().getPluginManager().registerListener(this, new EventListener(this, this.proxyCore));

getProxy().registerChannel(ProxyMessages.CHANNEL_NAME);

getProxy().getPluginManager().registerListener(this, new EventListener(this, this.proxyCore));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public EventListener(AdvancedPortalsBungeePlugin plugin, AdvancedPortalsProxyCor

@EventHandler
public void onMessageReceived(PluginMessageEvent event) {
this.plugin.getLogger().info("Message received " + event.getTag());
if(!event.getTag().equalsIgnoreCase(ProxyMessages.CHANNEL_NAME)) return;
event.setCancelled(true);

Expand All @@ -36,6 +37,7 @@ public void onMessageReceived(PluginMessageEvent event) {

@EventHandler
public void onServerConnected(ServerConnectedEvent event) {
this.plugin.getLogger().info("Server connected " + event.getServer().getInfo().getName());
this.proxyCore.onServerConnect(new BungeeProxyServerContainer(event.getServer()), new BungeeProxyPlayerContainer(event.getPlayer()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
public class ProxyMessages {

public static String CHANNEL_NAME = "advancedportals:warp";
public static String CHANNEL_NAME = "advancedportals";

public static String PROXY_TRANSFER_DESTI = "proxy:transfer_desti";
public static String PROXY_TRANSFER = "proxy:transfer";
Expand Down

0 comments on commit 31b525e

Please sign in to comment.