mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Only call event when turning pressure plate on. Fixes BUKKIT-3881
This commit is contained in:
parent
82e05d435b
commit
af7ea28bc7
1 changed files with 15 additions and 13 deletions
|
@ -43,21 +43,23 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Entity entity = (Entity) iterator.next();
|
Entity entity = (Entity) iterator.next();
|
||||||
|
|
||||||
// CraftBukkit start - Fire interact event when turning on a pressure plate
|
// CraftBukkit start - Call interact event when turning on a pressure plate
|
||||||
org.bukkit.World bworld = world.getWorld();
|
if (this.c(world.getData(i, j, k)) == 0) {
|
||||||
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
org.bukkit.World bworld = world.getWorld();
|
||||||
org.bukkit.event.Cancellable cancellable;
|
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||||
|
org.bukkit.event.Cancellable cancellable;
|
||||||
|
|
||||||
if (entity instanceof EntityHuman) {
|
if (entity instanceof EntityHuman) {
|
||||||
cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
|
cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
|
||||||
} else {
|
} else {
|
||||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(i, j, k));
|
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(i, j, k));
|
||||||
manager.callEvent((EntityInteractEvent) cancellable);
|
manager.callEvent((EntityInteractEvent) cancellable);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We only want to block turning the plate on if all events are cancelled
|
// We only want to block turning the plate on if all events are cancelled
|
||||||
if (cancellable.isCancelled()) {
|
if (cancellable.isCancelled()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue