From 7dc47385287c1f8e946d1b954a0a54dc84361bd9 Mon Sep 17 00:00:00 2001 From: Nathan Wolf Date: Thu, 2 Aug 2018 16:18:11 -0700 Subject: [PATCH] SPIGOT-4212: EntityInteractEvent when an entity tries to interact with a door --- nms-patches/PathfinderGoalDoorInteract.patch | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 nms-patches/PathfinderGoalDoorInteract.patch diff --git a/nms-patches/PathfinderGoalDoorInteract.patch b/nms-patches/PathfinderGoalDoorInteract.patch new file mode 100644 index 0000000000..2b2ba9dde6 --- /dev/null +++ b/nms-patches/PathfinderGoalDoorInteract.patch @@ -0,0 +1,17 @@ +--- a/net/minecraft/server/PathfinderGoalDoorInteract.java ++++ b/net/minecraft/server/PathfinderGoalDoorInteract.java +@@ -37,6 +37,14 @@ + IBlockData iblockdata = this.a.world.getType(this.b); + + if (iblockdata.getBlock() instanceof BlockDoor) { ++ // CraftBukkit start - entities opening doors ++ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(this.a.getBukkitEntity(), this.a.world.getWorld().getBlockAt(this.b.getX(), this.b.getY(), this.b.getZ())); ++ this.a.world.getServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ return; ++ } ++ // CaftBukkit end ++ + ((BlockDoor) iblockdata.getBlock()).setDoor(this.a.world, this.b, flag); + } + }