Cleanup and rework physical interaction events. Fixes BUKKIT-3686

Currently when dealing with physical interactions with pressure plates
and tripwires we immediately block their activation as soon as a single
entity involved has their event cancelled. We also fire events whenever
an entity intersects the block a wooden button is in even if they aren't
actually pressing it. To correct this we move the button interaction to
the correct place and modify all three to only block the activation if
every entity is blocked from using them instead of just one of them.
This commit is contained in:
Travis Watkins
2013-03-22 14:34:18 -05:00
parent ae19f2c46f
commit 444ced306a
3 changed files with 52 additions and 30 deletions

View File

@@ -43,7 +43,7 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
// CraftBukkit start
// CraftBukkit start - Fire interact event when turning on a pressure plate
org.bukkit.World bworld = world.getWorld();
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
org.bukkit.event.Cancellable cancellable;
@@ -55,8 +55,9 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
manager.callEvent((EntityInteractEvent) cancellable);
}
// We only want to block turning the plate on if all events are cancelled
if (cancellable.isCancelled()) {
return 0;
continue;
}
// CraftBukkit end