diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerChat.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerChat.java index 62747cb..a40644e 100644 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerChat.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerChat.java @@ -23,7 +23,7 @@ import java.util.regex.Pattern; public final class PlayerChat implements Listener { private static final PlayerChatRenderer CHAT_RENDERER = new PlayerChatRenderer(); - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOW) void onAsyncChatEventProcess(final AsyncChatEvent event) { final UUID playerUuid = event.getPlayer().getUniqueId(); @@ -33,6 +33,7 @@ public final class PlayerChat implements Listener { if (millisDifference < 50) { event.setCancelled(true); + return; } } diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java index b1fd441..cc3e5d0 100644 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java @@ -6,6 +6,7 @@ import java.util.UUID; import io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent; import org.bukkit.command.CommandSender; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -14,7 +15,7 @@ import pw.kaboom.extras.modules.server.ServerCommand; public final class PlayerCommand implements Listener { private static HashMap commandMillisList = new HashMap(); - @EventHandler + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOW) void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) { final UUID playerUuid = event.getPlayer().getUniqueId(); @@ -24,15 +25,12 @@ public final class PlayerCommand implements Listener { if (millisDifference < 75) { event.setCancelled(true); + return; } } getCommandMillisList().put(playerUuid, System.currentTimeMillis()); - if (event.isCancelled()) { - return; - } - final CommandSender sender = event.getPlayer(); final String command = event.getMessage(); final boolean isConsoleCommand = false;