Players with build permission can trample crops.
Previously, no crop trampling - now it's possible if the player has build permission. Non-players (animals/monsters) still can't trample because it's possible they may be manipulated by griefers to do that.
This commit is contained in:
parent
c92986bf5d
commit
62b3c9098c
|
|
@ -138,11 +138,23 @@ public class EntityEventHandler implements Listener
|
|||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
//don't allow crops to be trampled
|
||||
//don't allow crops to be trampled, except by a player with build permission
|
||||
else if(event.getTo() == Material.DIRT && event.getBlock().getType() == Material.SOIL)
|
||||
{
|
||||
if(event.getEntityType() != EntityType.PLAYER)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Player player = (Player)event.getEntity();
|
||||
Block block = event.getBlock();
|
||||
if(GriefPrevention.instance.allowBreak(player, block, block.getLocation()) != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//sand cannon fix - when the falling block doesn't fall straight down, take additional anti-grief steps
|
||||
else if (event.getEntityType() == EntityType.FALLING_BLOCK)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user