Commits

md_5 authored 5a3813d7fe4
SPIGOT-1608: Add a way to get the hand used in PlayerInteract*Events
No tags

nms-patches/BlockPressurePlateBinary.patch

Modified
13 13 while (iterator.hasNext()) {
14 14 Entity entity = (Entity) iterator.next();
15 15
16 16 + // CraftBukkit start - Call interact event when turning on a pressure plate
17 17 + if (this.getPower(world.getType(blockposition)) == 0) {
18 18 + org.bukkit.World bworld = world.getWorld();
19 19 + org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
20 20 + org.bukkit.event.Cancellable cancellable;
21 21 +
22 22 + if (entity instanceof EntityHuman) {
23 -+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null);
23 ++ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
24 24 + } else {
25 25 + cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
26 26 + manager.callEvent((EntityInteractEvent) cancellable);
27 27 + }
28 28 +
29 29 + // We only want to block turning the plate on if all events are cancelled
30 30 + if (cancellable.isCancelled()) {
31 31 + continue;
32 32 + }
33 33 + }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut