diff --git a/src/main/java/com/tocard/cam/Camera.java b/src/main/java/com/tocard/cam/Camera.java index d6009f0..098c5e2 100644 --- a/src/main/java/com/tocard/cam/Camera.java +++ b/src/main/java/com/tocard/cam/Camera.java @@ -44,6 +44,39 @@ public class Camera extends JavaPlugin implements Listener { getServer().getPluginManager().registerEvents(this, this); } + @Override + public void onDisable() { + ClearPoints.clear(); + } + + // ---------------------------------------------------------------------------------------------------- + + @EventHandler + public void onInteract(PlayerInteractEvent event) { + Action action = event.getAction(); + Player player = event.getPlayer(); + + if (action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) { + ItemStack helditem = player.getPlayer().getInventory().getItemInMainHand(); + switch (helditem.getType()) { + case STICK: + player.chat("/point add"); + break; + case PAPER: + player.chat("/show"); + break; + case SLIME_BALL: + player.chat("/exec"); + break; + case BRICK: + ClearPoints.clear(); + break; + default: + break; + } + } + } + public static void compute() { int nControlPoints = controlPoints.size(); @@ -91,11 +124,6 @@ public class Camera extends JavaPlugin implements Listener { } } - public static void broadlog(String msg) { - Camera.logger.log(Level.INFO, msg); - Bukkit.broadcastMessage(msg); - } - public static String prettyLocation(LocationQuaternion point) { point.updateEulerAngles(); return String.format("X=%05.2f, Y=%05.2f, Z=%05.2f, P=%05.2f, Y=%05.2f", @@ -103,34 +131,9 @@ public class Camera extends JavaPlugin implements Listener { point.getPitch(), point.getYaw()); } - @Override - public void onDisable() { - ClearPoints.clear(); + public static void broadlog(String msg) { + Camera.logger.log(Level.INFO, msg); + Bukkit.broadcastMessage(msg); } - @EventHandler - public void onInteract(PlayerInteractEvent event) { - Action action = event.getAction(); - Player player = event.getPlayer(); - - if (action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) { - ItemStack helditem = player.getPlayer().getInventory().getItemInMainHand(); - switch (helditem.getType()) { - case STICK: - player.chat("/point add"); - break; - case PAPER: - player.chat("/show"); - break; - case SLIME_BALL: - player.chat("/exec"); - break; - case BRICK: - player.chat("/reset"); - break; - default: - break; - } - } - } }