From 31b525e31dee740e0cf9318bd46d4d4430e266fb Mon Sep 17 00:00:00 2001 From: Sekwah Date: Thu, 24 Oct 2024 17:46:32 +0100 Subject: [PATCH] wip: connecting the proxy --- .../advancedportals/bungee/AdvancedPortalsBungeePlugin.java | 3 ++- .../java/com/sekwah/advancedportals/bungee/EventListener.java | 2 ++ .../java/com/sekwah/advancedportals/core/ProxyMessages.java | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bungee/src/main/java/com/sekwah/advancedportals/bungee/AdvancedPortalsBungeePlugin.java b/bungee/src/main/java/com/sekwah/advancedportals/bungee/AdvancedPortalsBungeePlugin.java index c28347ae..8bf80095 100644 --- a/bungee/src/main/java/com/sekwah/advancedportals/bungee/AdvancedPortalsBungeePlugin.java +++ b/bungee/src/main/java/com/sekwah/advancedportals/bungee/AdvancedPortalsBungeePlugin.java @@ -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 diff --git a/bungee/src/main/java/com/sekwah/advancedportals/bungee/EventListener.java b/bungee/src/main/java/com/sekwah/advancedportals/bungee/EventListener.java index 5ffc43f0..6b170f0b 100644 --- a/bungee/src/main/java/com/sekwah/advancedportals/bungee/EventListener.java +++ b/bungee/src/main/java/com/sekwah/advancedportals/bungee/EventListener.java @@ -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); @@ -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())); } } diff --git a/core/src/main/java/com/sekwah/advancedportals/core/ProxyMessages.java b/core/src/main/java/com/sekwah/advancedportals/core/ProxyMessages.java index c6e73f46..e47472d9 100644 --- a/core/src/main/java/com/sekwah/advancedportals/core/ProxyMessages.java +++ b/core/src/main/java/com/sekwah/advancedportals/core/ProxyMessages.java @@ -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";