diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakePlayerModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakePlayerModule.java index 196240be6..264356153 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakePlayerModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakePlayerModule.java @@ -88,7 +88,7 @@ public class CakePlayerModule extends CakeModule } @EventHandler(priority = EventPriority.MONITOR) - public void blockBreak(BlockPlaceEvent event) + public void blockPlaceRecord(BlockPlaceEvent event) { if (event.isCancelled()) { @@ -121,12 +121,26 @@ public class CakePlayerModule extends CakeModule } @EventHandler - public void holdingRunePlace(BlockPlaceEvent event) + public void blockPlacePrevent(BlockPlaceEvent event) { - if (event.getItemInHand().getType() == RUNE_OF_HOLDING.getType()) + Player player = event.getPlayer(); + ItemStack itemStack = player.getItemInHand(); + + if (itemStack == null) + { + return; + } + + if (itemStack.getType() == RUNE_OF_HOLDING.getType()) { event.setCancelled(true); - event.getPlayer().sendMessage(F.main("Game", "You cannot place a " + F.name(RUNE_OF_HOLDING.getItemMeta().getDisplayName()) + ".")); + player.sendMessage(F.main("Game", "You cannot place a " + F.name(RUNE_OF_HOLDING.getItemMeta().getDisplayName()) + ".")); + } + else if (itemStack.getType() == Material.BARRIER) + { + event.setCancelled(true); + player.setItemInHand(null); + player.sendMessage(F.main("Game", "You cannot place " + F.name("Barriers") + ".")); } }