1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
--- a/net/minecraft/server/EntityArmorStand.java
+++ b/net/minecraft/server/EntityArmorStand.java
@@ -5,6 +5,15 @@
import java.util.List;
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.craftbukkit.CraftEquipmentSlot;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.entity.ArmorStand;
+import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
+// CraftBukkit end
+
public class EntityArmorStand extends EntityLiving {
private static final Vector3f bq = new Vector3f(0.0F, 0.0F, 0.0F);
@@ -364,6 +373,21 @@
if (itemstack1.isEmpty() || (this.bA & 1 << enumitemslot.c() + 8) == 0) {
if (!itemstack1.isEmpty() || (this.bA & 1 << enumitemslot.c() + 16) == 0) {
ItemStack itemstack2;
+ // CraftBukkit start
+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack1);
+ org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemstack);
+
+ Player player = (Player) entityhuman.getBukkitEntity();
+ ArmorStand self = (ArmorStand) this.getBukkitEntity();
+
+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(enumitemslot);
+ PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player,self,playerHeldItem,armorStandItem,slot);
+ this.world.getServer().getPluginManager().callEvent(armorStandManipulateEvent);
+
+ if (armorStandManipulateEvent.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
itemstack2 = itemstack.cloneItemStack();
@@ -385,6 +409,11 @@
}
public boolean damageEntity(DamageSource damagesource, float f) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
+ return false;
+ }
+ // CraftBukkit end
if (!this.world.isClientSide && !this.dead) {
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
this.die();
|