From aa99d679632a9f8ac6560eced7457f6c72c9adc0 Mon Sep 17 00:00:00 2001 From: feildmaster Date: Thu, 22 Nov 2012 23:05:27 -0600 Subject: Call EntityInteractEvent for Wood Buttons. Fixes BUKKIT-3022 Prior to this, there was no way to tell when arrows trigger buttons --- src/main/java/net/minecraft/server/BlockButton.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/main/java/net/minecraft/server') diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButton.java index 908b1ede..ab8bc44f 100644 --- a/src/main/java/net/minecraft/server/BlockButton.java +++ b/src/main/java/net/minecraft/server/BlockButton.java @@ -3,7 +3,10 @@ package net.minecraft.server; import java.util.List; import java.util.Random; -import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit +// CraftBukkit start +import org.bukkit.event.block.BlockRedstoneEvent; +import org.bukkit.event.entity.EntityInteractEvent; +// CraftBukkit end public class BlockButton extends Block { @@ -235,6 +238,14 @@ public class BlockButton extends Block { if (!world.isStatic) { if (this.a) { if ((world.getData(i, j, k) & 8) == 0) { + // CraftBukkit start - Call interaction when entities (currently arrows) hit wooden buttons + EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(i, j, k)); + world.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) { + return; + } + // CraftBukkit end this.o(world, i, j, k); } } -- cgit v1.2.3