2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/BlockPressurePlateBinary.java
|
|
|
|
+++ b/net/minecraft/server/BlockPressurePlateBinary.java
|
2014-11-25 22:32:16 +01:00
|
|
|
@@ -3,6 +3,8 @@
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
|
|
|
|
|
|
|
|
public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered");
|
2016-02-29 22:32:46 +01:00
|
|
|
@@ -63,6 +65,26 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
while (iterator.hasNext()) {
|
|
|
|
Entity entity = (Entity) iterator.next();
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start - Call interact event when turning on a pressure plate
|
2016-02-29 22:32:46 +01:00
|
|
|
+ if (this.getPower(world.getType(blockposition)) == 0) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ org.bukkit.World bworld = world.getWorld();
|
|
|
|
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
|
|
|
+ org.bukkit.event.Cancellable cancellable;
|
|
|
|
+
|
|
|
|
+ if (entity instanceof EntityHuman) {
|
2016-03-04 05:24:51 +01:00
|
|
|
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ } else {
|
|
|
|
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
|
|
|
+ manager.callEvent((EntityInteractEvent) cancellable);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // We only want to block turning the plate on if all events are cancelled
|
|
|
|
+ if (cancellable.isCancelled()) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2015-02-26 23:41:06 +01:00
|
|
|
+
|
2016-02-29 22:32:46 +01:00
|
|
|
if (!entity.isIgnoreBlockTrigger()) {
|
2014-11-25 22:32:16 +01:00
|
|
|
return 15;
|
2015-02-26 23:41:06 +01:00
|
|
|
}
|