mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-01 01:11:51 +00:00
Simplify code
This commit is contained in:
parent
0c99c440a8
commit
b82c63a3ed
|
@ -144,7 +144,6 @@ class EntitySpawn implements Listener {
|
|||
|
||||
if (dragonCount > 25) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (event.getEntityType() == EntityType.MAGMA_CUBE) {
|
||||
final MagmaCube magmacube = (MagmaCube) event.getEntity();
|
||||
|
@ -279,7 +278,6 @@ class EntitySpawn implements Listener {
|
|||
|
||||
if (dragonCount > 25) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -312,7 +310,6 @@ class EntitySpawn implements Listener {
|
|||
}
|
||||
} catch (Exception exception) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,7 +320,6 @@ class EntitySpawn implements Listener {
|
|||
|
||||
if (block.getBlockData().getMaterial() == Material.SPAWNER) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,11 +41,11 @@ class PlayerCommand implements Listener {
|
|||
|
||||
if (("/minecraft:execute".equals(arr[0].toLowerCase()) ||
|
||||
"/execute".equals(arr[0].toLowerCase())) &&
|
||||
arr.length >= 1) {
|
||||
arr.length >= 2) {
|
||||
final StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
for (int i = 1; i < arr.length; i++) {
|
||||
stringBuilder.append(arr[i] + " ");
|
||||
stringBuilder.append(arr[i]).append(" ");
|
||||
}
|
||||
if (stringBuilder.toString().toLowerCase().contains("run execute") ||
|
||||
stringBuilder.toString().toLowerCase().contains("run gamerule randomtickspeed") ||
|
||||
|
@ -68,11 +68,11 @@ class PlayerCommand implements Listener {
|
|||
final StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
stringBuilder.append(arr[i] + " ");
|
||||
stringBuilder.append(arr[i]).append(" ");
|
||||
}
|
||||
stringBuilder.append("10 ");
|
||||
for (int i = 10; i < arr.length; i++) {
|
||||
stringBuilder.append(arr[i] + " ");
|
||||
stringBuilder.append(arr[i]).append(" ");
|
||||
}
|
||||
|
||||
event.setMessage(stringBuilder.toString());
|
||||
|
|
|
@ -21,13 +21,15 @@ class ServerCommand implements Listener {
|
|||
final String[] arr = event.getCommand().split(" ");
|
||||
final String command = event.getCommand();
|
||||
|
||||
if (("minecraft:execute".equals(arr[0].toLowerCase()) ||
|
||||
if (main.consoleCommandBlacklist.contains(arr[0].toLowerCase())) {
|
||||
event.setCancelled(true);
|
||||
} else if (("minecraft:execute".equals(arr[0].toLowerCase()) ||
|
||||
"execute".equals(arr[0].toLowerCase())) &&
|
||||
arr.length >= 1) {
|
||||
arr.length >= 2) {
|
||||
final StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
for (int i = 1; i < arr.length; i++) {
|
||||
stringBuilder.append(arr[i] + " ");
|
||||
stringBuilder.append(arr[i]).append(" ");
|
||||
}
|
||||
if (stringBuilder.toString().toLowerCase().contains("run execute") ||
|
||||
stringBuilder.toString().toLowerCase().contains("run gamerule randomtickspeed") ||
|
||||
|
@ -36,8 +38,6 @@ class ServerCommand implements Listener {
|
|||
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])) &&
|
||||
arr.length >= 3) {
|
||||
|
@ -52,11 +52,11 @@ class ServerCommand implements Listener {
|
|||
final StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
stringBuilder.append(arr[i] + " ");
|
||||
stringBuilder.append(arr[i]).append(" ");
|
||||
}
|
||||
stringBuilder.append("10 ");
|
||||
for (int i = 10; i < arr.length; i++) {
|
||||
stringBuilder.append(arr[i] + " ");
|
||||
stringBuilder.append(arr[i]).append(" ");
|
||||
}
|
||||
|
||||
event.setCommand(stringBuilder.toString());
|
||||
|
|
Loading…
Reference in a new issue