Fixed player controlled mounts killing crops.
(Even when creatures trampling crops is allowed.)
This commit is contained in:
parent
0a9d8e30dd
commit
2ca6b429e3
|
|
@ -166,10 +166,22 @@ class EntityEventHandler implements Listener
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onEntityInteract(EntityInteractEvent event)
|
public void onEntityInteract(EntityInteractEvent event)
|
||||||
{
|
{
|
||||||
if(!GriefPrevention.instance.config_creaturesTrampleCrops && event.getBlock().getType() == Material.SOIL)
|
Material material = event.getBlock().getType();
|
||||||
|
if(material == Material.SOIL)
|
||||||
|
{
|
||||||
|
if(!GriefPrevention.instance.config_creaturesTrampleCrops)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Entity rider = event.getEntity().getPassenger();
|
||||||
|
if(rider != null && rider.getType() == EntityType.PLAYER)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//when an entity explodes...
|
//when an entity explodes...
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user