Fix #201, prevent opening zone edge chests if not playing

Roundabout fix but it solves the issue with smuggling items without requiring an additional setting
This commit is contained in:
Connor Monahan 2017-07-20 15:51:38 -04:00
parent b772b71803
commit b7138d65bd
1 changed files with 8 additions and 0 deletions

View File

@ -288,6 +288,14 @@ public class WarPlayerListener implements Listener {
event.setCancelled(true);
War.war.badMsg(player, "drop.flag.disabled");
}
if (zone == null && event.getAction() == Action.RIGHT_CLICK_BLOCK
&& (event.getClickedBlock().getType() == Material.CHEST || event.getClickedBlock().getType() == Material.TRAPPED_CHEST)
&& Warzone.getZoneByLocation(event.getClickedBlock().getLocation()) != null
&& !War.war.isZoneMaker(event.getPlayer())) {
// prevent opening chests inside a warzone if a player is not a zone maker
event.setCancelled(true);
player.playSound(player.getLocation(), Sound.BLOCK_CHEST_LOCKED, 1, 0);
}
}
if (event.getAction() == Action.RIGHT_CLICK_BLOCK