diff --git a/plugin.yml b/plugin.yml index e798bdc..9d3fc8c 100644 --- a/plugin.yml +++ b/plugin.yml @@ -3,7 +3,7 @@ main: me.ryanhamshire.GriefPrevention.GriefPrevention softdepend: [Vault, Multiverse-Core, My Worlds, MystCraft, Transporter, TheUnderground, WorldGuard, WorldEdit] dev-url: http://dev.bukkit.org/server-mods/grief-prevention loadbefore: [TheUnderground] -version: 10.5.3 +version: 10.5.5 commands: abandonclaim: description: Deletes a claim. diff --git a/src/me/ryanhamshire/GriefPrevention/EntityEventHandler.java b/src/me/ryanhamshire/GriefPrevention/EntityEventHandler.java index 60bf848..c0070ff 100644 --- a/src/me/ryanhamshire/GriefPrevention/EntityEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/EntityEventHandler.java @@ -107,6 +107,12 @@ class EntityEventHandler implements Listener { event.setCancelled(true); } + + //don't allow players to trample crops + else if(event.getEntityType() == EntityType.PLAYER && event.getBlock().getType() == Material.SOIL) + { + 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) diff --git a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java index b2ea81f..7e353f1 100644 --- a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java @@ -1243,6 +1243,7 @@ class PlayerEventHandler implements Listener //not interested in left-click-on-air actions Action action = event.getAction(); if(action == Action.LEFT_CLICK_AIR) return; + if(action == Action.PHYSICAL) return; Player player = event.getPlayer(); Block clickedBlock = event.getClickedBlock(); //null returned here means interacting with air @@ -1257,20 +1258,7 @@ class PlayerEventHandler implements Listener clickedBlockType = Material.AIR; } - //apply rule for players trampling tilled soil back to dirt (never allow it) - //NOTE: that this event applies only to players. monsters and animals can still trample. - if(action == Action.PHYSICAL) - { - if(clickedBlockType == Material.SOIL) - { - event.setCancelled(true); - } - - //not tracking any other "physical" interaction events right now - return; - } - - //don't care about left-clicking on most blocks, this is probably a break action + //don't care about left-clicking on most blocks, this is probably a break action PlayerData playerData = null; if(action == Action.LEFT_CLICK_BLOCK && clickedBlock != null) {