From 8fd11f85c49eb0ee3bd6c649e0730256394e15e0 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Sat, 27 Jul 2024 22:30:05 +0100 Subject: [PATCH] fix: stop portal packets still being forwarded to the client Thanks to rooter.rs for notifying me of these issues :) Multiple people made me aware of this one, but they were the first :D For details see https://roote.rs/posts/advancedportals/ --- .../bungee/listener/PluginMessageReceiver.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/sekwah/advancedportals/bungee/listener/PluginMessageReceiver.java b/src/main/java/com/sekwah/advancedportals/bungee/listener/PluginMessageReceiver.java index 5d2d3065..a8a65620 100644 --- a/src/main/java/com/sekwah/advancedportals/bungee/listener/PluginMessageReceiver.java +++ b/src/main/java/com/sekwah/advancedportals/bungee/listener/PluginMessageReceiver.java @@ -19,7 +19,10 @@ public class PluginMessageReceiver implements Listener { @EventHandler public void onMessageReceived(PluginMessageEvent event) { - if(!event.getTag().equalsIgnoreCase(BungeeMessages.CHANNEL_NAME) || !(event.getSender() instanceof Server)) return; + if(!event.getTag().equalsIgnoreCase(BungeeMessages.CHANNEL_NAME)) return; + event.setCancelled(true); + + if(!(event.getSender() instanceof Server)) return; ByteArrayDataInput in = ByteStreams.newDataInput(event.getData()); String subChannel = in.readUTF(); @@ -43,7 +46,5 @@ public class PluginMessageReceiver implements Listener { plugin.getProxy().getPluginManager().dispatchCommand(player, command); } } - - event.setCancelled(true); } }