Prevent players from using bonemeal on grass if they aren't allowed to build in a region

This commit is contained in:
Wizjany 2011-06-11 14:13:46 -04:00
parent 233a2bdbe7
commit d971389746

View File

@ -382,6 +382,16 @@ private void handleBlockRightClick(PlayerInteractEvent event) {
event.setCancelled(true);
return;
}
if (item.getData().getItemType() == Material.INK_SACK
&& item.getData().getData() == 15 // bonemeal
&& type == Material.GRASS) {
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
&& !set.canBuild(localPlayer)) {
event.setCancelled(true);
event.setUseInteractedBlock(Result.DENY);
event.setUseItemInHand(Result.DENY);
}
}
if (type == Material.CHEST
|| type == Material.JUKEBOX //stores the (arguably) most valuable item