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/
This commit is contained in:
Sekwah 2024-07-27 22:30:05 +01:00
parent 258ede7501
commit 8fd11f85c4

View File

@ -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);
}
}