Skip to content

Commit

Permalink
[BungeeCord / Velocity] Block bridge communication messages from play…
Browse files Browse the repository at this point in the history
…er to avoid exploits
  • Loading branch information
NEZNAMY committed Mar 1, 2025
1 parent ee47428 commit ba06f80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ public void onCommand(ChatEvent e) {
@EventHandler
public void onPluginMessage(PluginMessageEvent e) {
if (!e.getTag().equals(TabConstants.PLUGIN_MESSAGE_CHANNEL_NAME)) return;
e.setCancelled(true); // Also cancel messages from players to prevent exploits
if (TAB.getInstance().isPluginDisabled()) return;
if (e.getReceiver() instanceof ProxiedPlayer) {
e.setCancelled(true);
pluginMessage(((ProxiedPlayer) e.getReceiver()).getUniqueId(), e.getData());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ public void onCommand(@NotNull CommandExecuteEvent e) {
*/
@Subscribe
public void onPluginMessageEvent(@NotNull PluginMessageEvent e) {
if (TAB.getInstance().isPluginDisabled()) return;
if (!e.getIdentifier().getId().equals(TabConstants.PLUGIN_MESSAGE_CHANNEL_NAME)) return;
e.setResult(PluginMessageEvent.ForwardResult.handled()); // Also cancel messages from players to prevent exploits
if (TAB.getInstance().isPluginDisabled()) return;
if (e.getTarget() instanceof Player) {
e.setResult(PluginMessageEvent.ForwardResult.handled());
pluginMessage(((Player) e.getTarget()).getUniqueId(), e.getData());
}
}
Expand Down

0 comments on commit ba06f80

Please sign in to comment.