diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulatorListener.java b/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulatorListener.java index a0210ac..80ca456 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulatorListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/TNTSimulatorListener.java @@ -58,18 +58,23 @@ public class TNTSimulatorListener implements Listener { return; } - if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_AIR) { - startSimulation(event.getPlayer()); - return; + switch (event.getAction()) { + case LEFT_CLICK_BLOCK: + case LEFT_CLICK_AIR: + startSimulation(event.getPlayer()); + break; + case RIGHT_CLICK_BLOCK: + Vector location = event.getClickedBlock().getLocation().toVector().add(event.getBlockFace().getDirection()).add(HALF); + TNTSpawn tntSpawn = new TNTSpawn(location); + addTNT(event.getPlayer(), tntSpawn); + editTNT(event.getPlayer(), tntSpawn); + break; + case RIGHT_CLICK_AIR: + openSimulator(event.getPlayer()); + break; + default: + break; } - if (event.getClickedBlock() == null) { - openSimulator(event.getPlayer()); - return; - } - Vector location = event.getClickedBlock().getLocation().toVector().add(event.getBlockFace().getDirection()).add(HALF); - TNTSpawn tntSpawn = new TNTSpawn(location); - addTNT(event.getPlayer(), tntSpawn); - editTNT(event.getPlayer(), tntSpawn); } @EventHandler