diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/CakeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/CakeWars.java index 80b82bc47..12e6750b2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/CakeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/CakeWars.java @@ -10,6 +10,7 @@ import java.util.concurrent.TimeUnit; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -800,6 +801,11 @@ public class CakeWars extends TeamGame return _averages.get(team); } + public boolean isNearSpawn(Block block) + { + return isNearSpawn(block.getLocation().add(0.5, 0, 0.5)); + } + public boolean isNearSpawn(Location location) { for (List locations : WorldData.SpawnLocs.values()) 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 72617998a..9ea18ea08 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 @@ -143,7 +143,7 @@ public class CakePlayerModule extends CakeModule event.setCancelled(true); player.sendMessage(F.main("Game", "You cannot place a " + F.name(RUNE_OF_HOLDING.getItemMeta().getDisplayName()) + ".")); } - else if (_game.isNearSpawn(event.getBlock().getLocation())) + else if (_game.isNearSpawn(event.getBlock())) { event.setCancelled(true); player.sendMessage(F.main("Game", "You cannot place blocks that near to a player spawn.")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakeSpawnerModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakeSpawnerModule.java index e1b34fef2..39f08e724 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakeSpawnerModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/general/CakeSpawnerModule.java @@ -5,6 +5,7 @@ import java.util.List; import org.bukkit.Location; import org.bukkit.Sound; +import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.Item; import org.bukkit.entity.Player; @@ -37,17 +38,10 @@ public class CakeSpawnerModule extends CakeModule super(game); } - @EventHandler + @EventHandler(ignoreCancelled = true) public void blockPlace(BlockPlaceEvent event) { - if (event.isCancelled()) - { - return; - } - - Location block = event.getBlock().getLocation(); - - if (isNearSpawner(block)) + if (isNearSpawner(event.getBlock())) { event.setCancelled(true); event.getPlayer().sendMessage(F.main("Game", "You cannot place blocks that close to a generator.")); @@ -208,6 +202,11 @@ public class CakeSpawnerModule extends CakeModule } } + public boolean isNearSpawner(Block block) + { + return isNearSpawner(block.getLocation().add(0.5, 0, 0.5)); + } + public boolean isNearSpawner(Location location) { for (CakeTeam team : _game.getCakeTeamModule().getCakeTeams().values()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/item/CakeSpecialItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/item/CakeSpecialItem.java index 76776e81e..8cf1c0dfd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/item/CakeSpecialItem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/item/CakeSpecialItem.java @@ -44,7 +44,7 @@ public abstract class CakeSpecialItem protected boolean isInvalidBlock(Block block) { Location location = block.getLocation(); - return !UtilBlock.airFoliage(block) || _game.getCapturePointModule().isOnPoint(location) || _game.getCakeShopModule().isNearShop(location) || _game.getCakeSpawnerModule().isNearSpawner(location) || _game.isNearSpawn(location); + return !UtilBlock.airFoliage(block) || _game.getCapturePointModule().isOnPoint(location) || _game.getCakeShopModule().isNearShop(location) || _game.getCakeSpawnerModule().isNearSpawner(block) || _game.isNearSpawn(block); } public ItemStack getItemStack()