Fixed player controlled mounts killing crops.
(Even when creatures trampling crops is allowed.)
This commit is contained in:
1 parent
0a9d8e30dd
commit
2ca6b429e3
1 file changed
+16
-4
@@ -92,7 +92,7 @@ class EntityEventHandler implements Listener
|
|||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onEntityChangeBLock(EntityChangeBlockEvent event)
|
public void onEntityChangeBLock(EntityChangeBlockEvent event)
|
||||||
{
|
{
|
||||||
if(!GriefPrevention.instance.config_endermenMoveBlocks && event.getEntityType() == EntityType.ENDERMAN)
|
if(!GriefPrevention.instance.config_endermenMoveBlocks && event.getEntityType() == EntityType.ENDERMAN)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@@ -166,9 +166,21 @@ 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)
|
||||||
event.setCancelled(true);
|
{
|
||||||
|
if(!GriefPrevention.instance.config_creaturesTrampleCrops)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Entity rider = event.getEntity().getPassenger();
|
||||||
|
if(rider != null && rider.getType() == EntityType.PLAYER)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user