diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockTripwire.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockTripwire.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/BlockTripwire.java b/src/main/java/net/minecraft/server/BlockTripwire.java index c741a684..1385732a 100644 --- a/src/main/java/net/minecraft/server/BlockTripwire.java +++ b/src/main/java/net/minecraft/server/BlockTripwire.java @@ -3,6 +3,11 @@ package net.minecraft.server; import java.util.List; import java.util.Random; +// CraftBukkit start +import org.bukkit.event.block.BlockRedstoneEvent; +import org.bukkit.event.entity.EntityInteractEvent; +// CraftBukkit end + public class BlockTripwire extends Block { public BlockTripwire(int i) { @@ -135,6 +140,39 @@ public class BlockTripwire extends Block { flag1 = true; } + // CraftBukkit start + org.bukkit.World bworld = world.getWorld(); + org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager(); + + if (flag != flag1) { + if (flag1) { + for (Object object : list) { + if (object != null) { + org.bukkit.event.Cancellable cancellable; + + if (object instanceof EntityHuman) { + cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null); + } else if (object instanceof Entity) { + cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), bworld.getBlockAt(i, j, k)); + manager.callEvent((EntityInteractEvent) cancellable); + } else { + continue; + } + + if (cancellable.isCancelled()) { + return; + } + } + } + } + + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(i, j, k), flag ? 1 : 0, flag1 ? 1 : 0); + manager.callEvent(eventRedstone); + + flag1 = eventRedstone.getNewCurrent() > 0; + } + // CraftBukkit end + if (flag1 && !flag) { l |= 1; } |