diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java old mode 100644 new mode 100755 index 98ef97e..f0938f7 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java @@ -24,12 +24,18 @@ class PlayerCommand implements Listener { final String[] arr = event.getMessage().split(" "); final String command = event.getMessage(); final UUID playerUuid = event.getPlayer().getUniqueId(); - final long millisDifference = System.currentTimeMillis() - main.commandMillisList.get(playerUuid); - + + if (main.commandMillisList.get(playerUuid) != null) { + final long millisDifference = System.currentTimeMillis() - main.commandMillisList.get(playerUuid); + + if (millisDifference < 200) { + event.setCancelled(true); + } + } + main.commandMillisList.put(playerUuid, System.currentTimeMillis()); - - if (millisDifference < 200) { - event.setCancelled(true); + + if (event.isCancelled()) { return; } diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java old mode 100644 new mode 100755 index 93f492a..29432f4 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java @@ -120,9 +120,6 @@ class PlayerConnection implements Listener { final Player player = event.getPlayer(); - main.commandMillisList.put(player.getUniqueId(), System.currentTimeMillis()); - main.interactMillisList.put(player.getUniqueId(), System.currentTimeMillis()); - event.allow(); player.setOp(true); diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java old mode 100644 new mode 100755 index 94cbfab..7f3c112 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java @@ -19,12 +19,15 @@ class PlayerInteract implements Listener { void onPlayerInteract(PlayerInteractEvent event) { final Player player = event.getPlayer(); final UUID playerUuid = event.getPlayer().getUniqueId(); - final long millisDifference = System.currentTimeMillis() - main.interactMillisList.get(playerUuid); - - main.interactMillisList.put(playerUuid, System.currentTimeMillis()); - - if (millisDifference < 150) { - event.setCancelled(true); + + if (main.interactMillisList.get(playerUuid) != null) { + final long millisDifference = System.currentTimeMillis() - main.interactMillisList.get(playerUuid); + + if (millisDifference < 150) { + event.setCancelled(true); + } } + + main.interactMillisList.put(playerUuid, System.currentTimeMillis()); } } diff --git a/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java b/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java index 264472e..c30645c 100644 --- a/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java +++ b/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java @@ -21,7 +21,22 @@ class ServerCommand implements Listener { final String[] arr = event.getCommand().split(" "); final String command = event.getCommand(); - if (main.consoleCommandBlacklist.contains(arr[0].toLowerCase())) { + if (("minecraft:execute".equals(arr[0].toLowerCase()) || + "execute".equals(arr[0].toLowerCase())) && + arr.length >= 1) { + final StringBuilder stringBuilder = new StringBuilder(); + + for (int i = 1; i < arr.length; i++) { + stringBuilder.append(arr[i] + " "); + } + if (stringBuilder.toString().toLowerCase().contains("run execute") || + stringBuilder.toString().toLowerCase().contains("run gamerule randomtickspeed") || + stringBuilder.toString().toLowerCase().contains("run particle") || + stringBuilder.toString().toLowerCase().contains("run save-off") || + stringBuilder.toString().toLowerCase().contains("run stop")) { + event.setCancelled(true); + } + } else if (main.consoleCommandBlacklist.contains(arr[0].toLowerCase())) { event.setCancelled(true); } else if (("minecraft:gamerule".equalsIgnoreCase(arr[0]) || "gamerule".equalsIgnoreCase(arr[0])) &&