From ebf07fc9e1bcb89eaa9e298030a6e985b5246cb6 Mon Sep 17 00:00:00 2001 From: RayzsYT <51991564+RayzsYT@users.noreply.github.com> Date: Fri, 23 Aug 2024 23:48:25 +0200 Subject: [PATCH] Update PAT-Event API --- .../bukkit/BukkitAntiTabListener.java | 2 +- .../bukkit/BukkitBlockCommandListener.java | 18 +++++++-------- .../bungee/BungeeAntiTabListener.java | 2 +- .../bungee/BungeeBlockCommandListener.java | 18 +++++++-------- .../bungee/WaterfallAntiTabListener.java | 2 +- .../velocity/VelocityAntiTabListener.java | 2 +- .../VelocityBlockCommandListener.java | 22 +++++++++---------- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/main/java/de/rayzs/pat/plugin/listeners/bukkit/BukkitAntiTabListener.java b/src/main/java/de/rayzs/pat/plugin/listeners/bukkit/BukkitAntiTabListener.java index 683c6ed1..9ad86e33 100644 --- a/src/main/java/de/rayzs/pat/plugin/listeners/bukkit/BukkitAntiTabListener.java +++ b/src/main/java/de/rayzs/pat/plugin/listeners/bukkit/BukkitAntiTabListener.java @@ -55,7 +55,7 @@ public class BukkitAntiTabListener implements Listener { final List playerCommands = COMMANDS_CACHE.getPlayerCommands(event.getCommands(), player, player.getUniqueId()); event.getCommands().clear(); - FilteredSuggestionEvent filteredSuggestionEvent = PATEventHandler.call(uuid, playerCommands); + FilteredSuggestionEvent filteredSuggestionEvent = PATEventHandler.call(player, playerCommands); if(filteredSuggestionEvent.isCancelled()) return; event.getCommands().addAll(filteredSuggestionEvent.getSuggestions()); diff --git a/src/main/java/de/rayzs/pat/plugin/listeners/bukkit/BukkitBlockCommandListener.java b/src/main/java/de/rayzs/pat/plugin/listeners/bukkit/BukkitBlockCommandListener.java index 2269b520..6757611e 100644 --- a/src/main/java/de/rayzs/pat/plugin/listeners/bukkit/BukkitBlockCommandListener.java +++ b/src/main/java/de/rayzs/pat/plugin/listeners/bukkit/BukkitBlockCommandListener.java @@ -43,7 +43,7 @@ public class BukkitBlockCommandListener implements Listener { List notificationMessage = MessageTranslator.replaceMessageList(Storage.ConfigSections.Messages.NOTIFICATION.ALERT, "%player%", player.getName(), "%command%", command, "%world%", worldName); if(Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isCommand(command) && !PermissionUtil.hasBypassPermission(player, command)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setCancelled(true); if(executeCommandEvent.isCancelled()) return; @@ -59,7 +59,7 @@ public class BukkitBlockCommandListener implements Listener { } if(Storage.ConfigSections.Settings.CUSTOM_VERSION.isCommand(command) && !PermissionUtil.hasBypassPermission(player, command)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setCancelled(true); if(executeCommandEvent.isCancelled()) return; @@ -80,18 +80,18 @@ public class BukkitBlockCommandListener implements Listener { if(Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED) { if(Storage.Blacklist.isListed(command, true)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setCancelled(true); return; } if(PermissionUtil.hasBypassPermission(player, command, false)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setCancelled(true); return; } - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setCancelled(true); if(executeCommandEvent.isCancelled()) return; @@ -101,7 +101,7 @@ public class BukkitBlockCommandListener implements Listener { if(Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.isCommand(command) && !Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.doesBypass(player)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setCancelled(true); if(executeCommandEvent.isCancelled()) return; @@ -117,18 +117,18 @@ public class BukkitBlockCommandListener implements Listener { } if (!Storage.Blacklist.isListed(command, false)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setCancelled(true); return; } if (PermissionUtil.hasBypassPermission(player, command, false)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setCancelled(true); return; } - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setCancelled(true); if(executeCommandEvent.isCancelled()) return; diff --git a/src/main/java/de/rayzs/pat/plugin/listeners/bungee/BungeeAntiTabListener.java b/src/main/java/de/rayzs/pat/plugin/listeners/bungee/BungeeAntiTabListener.java index 13096602..554e6446 100644 --- a/src/main/java/de/rayzs/pat/plugin/listeners/bungee/BungeeAntiTabListener.java +++ b/src/main/java/de/rayzs/pat/plugin/listeners/bungee/BungeeAntiTabListener.java @@ -31,7 +31,7 @@ public class BungeeAntiTabListener implements Listener { event.getSuggestions().removeIf(command -> Storage.Blacklist.isBlocked(player, command, !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED, player.getServer().getInfo().getName())); - FilteredSuggestionEvent filteredSuggestionEvent = PATEventHandler.call(player.getUniqueId(), event.getSuggestions()); + FilteredSuggestionEvent filteredSuggestionEvent = PATEventHandler.call(player, event.getSuggestions()); if(filteredSuggestionEvent.isCancelled()) event.getSuggestions().clear(); } } diff --git a/src/main/java/de/rayzs/pat/plugin/listeners/bungee/BungeeBlockCommandListener.java b/src/main/java/de/rayzs/pat/plugin/listeners/bungee/BungeeBlockCommandListener.java index b770fb18..afe976bc 100644 --- a/src/main/java/de/rayzs/pat/plugin/listeners/bungee/BungeeBlockCommandListener.java +++ b/src/main/java/de/rayzs/pat/plugin/listeners/bungee/BungeeBlockCommandListener.java @@ -40,7 +40,7 @@ public class BungeeBlockCommandListener implements Listener { List notificationMessage = MessageTranslator.replaceMessageList(Storage.ConfigSections.Messages.NOTIFICATION.ALERT, "%player%", player.getName(), "%command%", command, "%server%", serverName); if(Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isCommand(command) && !PermissionUtil.hasBypassPermission(player, command)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setCancelled(true); if(executeCommandEvent.isCancelled()) return; @@ -56,7 +56,7 @@ public class BungeeBlockCommandListener implements Listener { } if(Storage.ConfigSections.Settings.CUSTOM_VERSION.isCommand(command) && !PermissionUtil.hasBypassPermission(player, command)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setCancelled(true); if(executeCommandEvent.isCancelled()) return; @@ -78,7 +78,7 @@ public class BungeeBlockCommandListener implements Listener { boolean listed, serverListed, ignored; if(Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED) { if(Storage.Blacklist.doesGroupBypass(player, command, true, true, false, serverName)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setCancelled(true); return; } @@ -88,12 +88,12 @@ public class BungeeBlockCommandListener implements Listener { ignored = Storage.Blacklist.isOnIgnoredServer(serverName); if(ignored ? !listed && serverListed : serverListed) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setCancelled(true); return; } - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setCancelled(true); if(executeCommandEvent.isCancelled()) return; @@ -102,7 +102,7 @@ public class BungeeBlockCommandListener implements Listener { } if(Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.isCommand(command) && !Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.doesBypass(player)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setCancelled(true); if(executeCommandEvent.isCancelled()) return; @@ -118,7 +118,7 @@ public class BungeeBlockCommandListener implements Listener { } if(Storage.Blacklist.doesGroupBypass(player, command, true, true, false, serverName)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setCancelled(true); return; } @@ -128,12 +128,12 @@ public class BungeeBlockCommandListener implements Listener { ignored = Storage.Blacklist.isOnIgnoredServer(serverName); if(!listed && !serverListed || listed && serverListed && ignored) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setCancelled(true); return; } - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setCancelled(true); if(executeCommandEvent.isCancelled()) return; diff --git a/src/main/java/de/rayzs/pat/plugin/listeners/bungee/WaterfallAntiTabListener.java b/src/main/java/de/rayzs/pat/plugin/listeners/bungee/WaterfallAntiTabListener.java index fe154787..91315464 100644 --- a/src/main/java/de/rayzs/pat/plugin/listeners/bungee/WaterfallAntiTabListener.java +++ b/src/main/java/de/rayzs/pat/plugin/listeners/bungee/WaterfallAntiTabListener.java @@ -39,7 +39,7 @@ public class WaterfallAntiTabListener implements Listener { List playerCommands = commandsCache.getPlayerCommands(commandsAsString, player, player.getUniqueId(), serverName); event.getCommands().entrySet().removeIf(command -> playerCommands.contains(command.getKey())); - FilteredSuggestionEvent filteredSuggestionEvent = PATEventHandler.call(player.getUniqueId(), new ArrayList<>(event.getCommands().keySet())); + FilteredSuggestionEvent filteredSuggestionEvent = PATEventHandler.call(player, new ArrayList<>(event.getCommands().keySet())); if(filteredSuggestionEvent.isCancelled()) event.getCommands().clear(); for (String commandName : filteredSuggestionEvent.getSuggestions()) { diff --git a/src/main/java/de/rayzs/pat/plugin/listeners/velocity/VelocityAntiTabListener.java b/src/main/java/de/rayzs/pat/plugin/listeners/velocity/VelocityAntiTabListener.java index d7501822..cff619b2 100644 --- a/src/main/java/de/rayzs/pat/plugin/listeners/velocity/VelocityAntiTabListener.java +++ b/src/main/java/de/rayzs/pat/plugin/listeners/velocity/VelocityAntiTabListener.java @@ -26,7 +26,7 @@ public class VelocityAntiTabListener { if(PermissionUtil.hasBypassPermission(player) || event.getSuggestions().isEmpty() || !player.getCurrentServer().isPresent()) return; event.getSuggestions().removeIf(command -> Storage.Blacklist.isBlocked(player, command, !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED, player.getCurrentServer().get().getServerInfo().getName())); - FilteredSuggestionEvent filteredSuggestionEvent = PATEventHandler.call(player.getUniqueId(), event.getSuggestions()); + FilteredSuggestionEvent filteredSuggestionEvent = PATEventHandler.call(player, event.getSuggestions()); if(filteredSuggestionEvent.isCancelled()) event.getSuggestions().clear(); } diff --git a/src/main/java/de/rayzs/pat/plugin/listeners/velocity/VelocityBlockCommandListener.java b/src/main/java/de/rayzs/pat/plugin/listeners/velocity/VelocityBlockCommandListener.java index 2dfe4645..072bb1bb 100644 --- a/src/main/java/de/rayzs/pat/plugin/listeners/velocity/VelocityBlockCommandListener.java +++ b/src/main/java/de/rayzs/pat/plugin/listeners/velocity/VelocityBlockCommandListener.java @@ -41,7 +41,7 @@ public class VelocityBlockCommandListener { List notificationMessage = MessageTranslator.replaceMessageList(Storage.ConfigSections.Messages.NOTIFICATION.ALERT, "%player%", player.getUsername(), "%command%", command, "%server%", serverName); if(Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isCommand(command)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setResult(CommandExecuteEvent.CommandResult.denied()); if(executeCommandEvent.isCancelled()) return; @@ -54,7 +54,7 @@ public class VelocityBlockCommandListener { } if(Storage.ConfigSections.Settings.CUSTOM_VERSION.isCommand(command)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setResult(CommandExecuteEvent.CommandResult.denied()); if(executeCommandEvent.isCancelled()) return; @@ -73,7 +73,7 @@ public class VelocityBlockCommandListener { if(Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED) { if(Storage.Blacklist.doesGroupBypass(player, command, false, true, false, player.getCurrentServer().get().getServerInfo().getName())) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setResult(CommandExecuteEvent.CommandResult.denied()); return; } @@ -83,12 +83,12 @@ public class VelocityBlockCommandListener { ignored = Storage.Blacklist.isOnIgnoredServer(serverName); if(ignored ? !listed && serverListed : serverListed) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setResult(CommandExecuteEvent.CommandResult.denied()); return; } - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setResult(CommandExecuteEvent.CommandResult.denied()); if(executeCommandEvent.isCancelled()) return; @@ -97,7 +97,7 @@ public class VelocityBlockCommandListener { } if(Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.isCommand(command) && !Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.doesBypass(player)) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setResult(CommandExecuteEvent.CommandResult.denied()); if(executeCommandEvent.isCancelled()) return; @@ -110,7 +110,7 @@ public class VelocityBlockCommandListener { } if(Storage.Blacklist.doesGroupBypass(player, command, true, true, false, player.getCurrentServer().get().getServerInfo().getName())) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setResult(CommandExecuteEvent.CommandResult.denied()); return; } @@ -120,18 +120,18 @@ public class VelocityBlockCommandListener { ignored = Storage.Blacklist.isOnIgnoredServer(serverName); if(!listed && !serverListed || listed && serverListed && ignored) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setResult(CommandExecuteEvent.CommandResult.denied()); return; } if(Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.isCommand(command) && Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.doesBypass(player.getUniqueId())) { - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, false); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, false); if(executeCommandEvent.isBlocked()) event.setResult(CommandExecuteEvent.CommandResult.denied()); return; } - ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player.getUniqueId(), rawCommand, true); + ExecuteCommandEvent executeCommandEvent = PATEventHandler.call(player, rawCommand, true); if(executeCommandEvent.isBlocked()) event.setResult(CommandExecuteEvent.CommandResult.denied()); if(executeCommandEvent.isCancelled()) return; @@ -140,4 +140,4 @@ public class VelocityBlockCommandListener { if(Storage.SEND_CONSOLE_NOTIFICATION) MessageTranslator.send(server.getConsoleCommandSource(), notificationMessage); Storage.NOTIFY_PLAYERS.stream().filter(uuid -> server.getPlayer(uuid).isPresent()).forEach(uuid -> MessageTranslator.send(server.getPlayer(uuid).get(), notificationMessage)); } -} +} \ No newline at end of file