2015-05-25 18:37:24 +08:00
|
|
|
--- a/net/minecraft/server/ItemHanging.java
|
|
|
|
+++ b/net/minecraft/server/ItemHanging.java
|
2016-03-01 05:32:46 +08:00
|
|
|
@@ -1,5 +1,10 @@
|
2014-11-26 05:32:16 +08:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.entity.Player;
|
|
|
|
+import org.bukkit.event.hanging.HangingPlaceEvent;
|
|
|
|
+// CraftBukkit end
|
|
|
|
+
|
|
|
|
public class ItemHanging extends Item {
|
|
|
|
|
2015-02-27 06:41:06 +08:00
|
|
|
private final Class<? extends EntityHanging> a;
|
2016-03-01 05:32:46 +08:00
|
|
|
@@ -17,6 +22,18 @@
|
2014-11-26 05:32:16 +08:00
|
|
|
|
2016-03-01 05:32:46 +08:00
|
|
|
if (entityhanging != null && entityhanging.survives()) {
|
|
|
|
if (!world.isClientSide) {
|
|
|
|
+ // CraftBukkit start - fire HangingPlaceEvent
|
|
|
|
+ Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
|
|
|
+ org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
|
|
+ org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection);
|
2014-11-26 05:32:16 +08:00
|
|
|
+
|
2016-03-01 05:32:46 +08:00
|
|
|
+ HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) entityhanging.getBukkitEntity(), who, blockClicked, blockFace);
|
|
|
|
+ world.getServer().getPluginManager().callEvent(event);
|
2014-11-26 05:32:16 +08:00
|
|
|
+
|
2016-03-01 05:32:46 +08:00
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return EnumInteractionResult.FAIL;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
entityhanging.o();
|
|
|
|
world.addEntity(entityhanging);
|
|
|
|
}
|