From 71555ef96e6378fae82dbf13196378f3bdcd29c0 Mon Sep 17 00:00:00 2001 From: mathias Date: Thu, 6 Sep 2018 15:25:51 +0300 Subject: [PATCH] Latest changes --- src/main/java/pw/kaboom/extras/Events.java | 29 ++++++++++++++++------ src/main/java/pw/kaboom/extras/Main.java | 1 + 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/main/java/pw/kaboom/extras/Events.java b/src/main/java/pw/kaboom/extras/Events.java index 27e04a8..eb38c6e 100644 --- a/src/main/java/pw/kaboom/extras/Events.java +++ b/src/main/java/pw/kaboom/extras/Events.java @@ -93,6 +93,11 @@ class Tick extends BukkitRunnable { } else if (worldborder.getCenter().getX() != 0 || worldborder.getCenter().getZ() != 0) { worldborder.setCenter(0, 0); } + + /*String tickSpeed = world.getGameRuleValue​("randomTickSpeed"); + if (Integer.parseInt(tickSpeed) > 10) { + world.setGameRuleValue​("randomTickSpeed", "10"); + }*/ } } } @@ -397,7 +402,7 @@ class Events implements Listener { double x = entity.getLocation().getX(); double z = entity.getLocation().getZ(); - if (entity.getWorld().getName() == "world") { + if (entity.getWorld().getName().equals("world")) { if ((x > -20 && x < 20) && (z > -20 && z < 20)) { event.setCancelled(true); } @@ -410,7 +415,7 @@ class Events implements Listener { double x = entity.getLocation().getX(); double z = entity.getLocation().getZ(); - if (entity.getWorld().getName() == "world") { + if (entity.getWorld().getName().equals("world")) { if ((x > -20 && x < 20) && (z > -20 && z < 20)) { event.setCancelled(true); } @@ -423,7 +428,7 @@ class Events implements Listener { double x = entity.getLocation().getX(); double z = entity.getLocation().getZ(); - if (entity.getWorld().getName() == "world") { + if (entity.getWorld().getName().equals("world")) { if ((x > -20 && x < 20) && (z > -20 && z < 20)) { event.setCancelled(true); } @@ -436,7 +441,7 @@ class Events implements Listener { double x = player.getLocation().getX(); double z = player.getLocation().getZ(); - if (player.getWorld().getName() == "world") { + if (player.getWorld().getName().equals("world")) { if ((x > -20 && x < 20) && (z > -20 && z < 20)) { event.setCancelled(true); } @@ -446,9 +451,8 @@ class Events implements Listener { @EventHandler void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { String arr[] = event.getMessage().split(" "); - String ar[] = event.getMessage().split(" ", 10); - /*if (arr[0].toLowerCase().equals("//schem") || + if (arr[0].toLowerCase().equals("//schem") || arr[0].toLowerCase().equals("//schematic") || arr[0].toLowerCase().equals("/schem") || arr[0].toLowerCase().equals("/schematic") || @@ -459,13 +463,17 @@ class Events implements Listener { if (arr[1].toLowerCase().equals("delete")) { event.setCancelled(true); } - } else */if (arr[0].toLowerCase().equals("/minecraft:particle") || + } else if (arr[0].toLowerCase().equals("/minecraft:gamerule") || + arr[0].toLowerCase().equals("/gamerule")) { + if (arr[2] != null && Integer.parseInt(arr[2]) > 6) { + event.setMessage(String.join(" ", arr[0], arr[1]) + " 6"); + } + } else if (arr[0].toLowerCase().equals("/minecraft:particle") || arr[0].toLowerCase().equals("/particle")) { if (arr[9] != null && Integer.parseInt(arr[9]) > 10) { event.setMessage(String.join(" ", arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8]) + " 10"); } } - event.setMessage(event.getMessage().substring(0, Math.min(256, event.getMessage().length()))); } @EventHandler @@ -520,6 +528,11 @@ class Events implements Listener { if (arr[1].toLowerCase().equals("delete")) { event.setCancelled(true); } + } else if (arr[0].toLowerCase().equals("/minecraft:gamerule") || + arr[0].toLowerCase().equals("/gamerule")) { + if (arr[2] != null && Integer.parseInt(arr[2]) > 6) { + event.setCommand(String.join(" ", arr[0], arr[1]) + " 6"); + } } else if (arr[0].toLowerCase().equals("minecraft:particle") || arr[0].toLowerCase().equals("particle")) { if (arr[9] != null && Integer.parseInt(arr[9]) > 10) { diff --git a/src/main/java/pw/kaboom/extras/Main.java b/src/main/java/pw/kaboom/extras/Main.java index e9b53e6..9bc21e5 100644 --- a/src/main/java/pw/kaboom/extras/Main.java +++ b/src/main/java/pw/kaboom/extras/Main.java @@ -309,6 +309,7 @@ public class Main extends JavaPlugin { "pm", "shoutworld", "say", + "setblock", "silence", "sp", "spec",