Don't allow placing banners and string. Fixes PC-333

This commit is contained in:
samczsun 2016-05-24 15:38:03 -04:00
parent 9853ef824e
commit 9acdbd7cbe
No known key found for this signature in database
GPG Key ID: B0AFDBD87206805D
1 changed files with 22 additions and 1 deletions

View File

@ -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);