Call EntityInteractEvent for Wood Buttons. Fixes BUKKIT-3022

Prior to this, there was no way to tell when arrows trigger buttons
Dieser Commit ist enthalten in:
feildmaster 2012-11-22 23:05:27 -06:00
Ursprung cd66edd40f
Commit aa99d67963

Datei anzeigen

@ -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);
}
}