forked from kaboomserver/extras
Avoid errors in checker
This commit is contained in:
parent
bb082a614d
commit
def1b6b32f
4 changed files with 36 additions and 15 deletions
16
src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java
Normal file → Executable file
16
src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java
Normal file → Executable file
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
3
src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java
Normal file → Executable file
3
src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java
Normal file → Executable file
|
@ -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);
|
||||
|
||||
|
|
15
src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java
Normal file → Executable file
15
src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java
Normal file → Executable file
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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])) &&
|
||||
|
|
Loading…
Reference in a new issue