From 9acdbd7cbeb8741b36fdd651750d9e877816c176 Mon Sep 17 00:00:00 2001 From: samczsun Date: Tue, 24 May 2016 15:38:03 -0400 Subject: [PATCH] Don't allow placing banners and string. Fixes PC-333 --- .../mineplex/game/clans/clans/ClansGame.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java index 00d3f6229..6f47a5525 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java @@ -303,7 +303,28 @@ public class ClansGame extends MiniPlugin UtilPlayer.message(player, F.main("Clans", "You cannot place blocks in " + F.elem("Borderlands") + ".")); return; } - + + // Banners/String + if (player.getGameMode() != GameMode.CREATIVE && player.getItemInHand() != null) + { + if (player.getItemInHand().getType() == Material.BANNER || player.getItemInHand().getType() == Material.STRING) + { + Location destLocation = event.getClickedBlock().getRelative(event.getBlockFace()).getLocation(); + ClanTerritory territory = _clans.getClanUtility().getClaim(destLocation); + if (territory != null) + { + if (territory.Owner.equals("Shops") || territory.Owner.equals("Fields") || territory.Owner.equals("Spawn") || territory.Owner.equals("Borderlands")) { + // Disallow + event.setCancelled(true); + + // Inform + UtilPlayer.message(player, F.main("Clans", "You cannot place that in " + F.elem(_clans.getClanUtility().getOwnerStringRel(destLocation, player)) + ".")); + return; + } + } + } + } + ClanRelation access = _clans.getClanUtility().getAccess(player, loc); ClanInfo clan = _clans.getClan(player); ClanInfo blockClan = _clans.getClanUtility().getClaim(loc) == null ? null : _clans.getClan(_clans.getClanUtility().getClaim(loc).Owner);