mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 20:30:28 +01:00
54 lines
2.3 KiB
Diff
54 lines
2.3 KiB
Diff
--- a/net/minecraft/server/EntityArmorStand.java
|
|
+++ b/net/minecraft/server/EntityArmorStand.java
|
|
@@ -2,6 +2,15 @@
|
|
|
|
import java.util.List;
|
|
|
|
+// 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 a = new Vector3f(0.0F, 0.0F, 0.0F);
|
|
@@ -332,6 +341,22 @@
|
|
ItemStack itemstack1 = entityhuman.inventory.getItem(j);
|
|
ItemStack itemstack2;
|
|
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack);
|
|
+ org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemstack1);
|
|
+
|
|
+ Player player = (Player) entityhuman.getBukkitEntity();
|
|
+ ArmorStand self = (ArmorStand) this.getBukkitEntity();
|
|
+
|
|
+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(i);
|
|
+ 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 && (itemstack == null || itemstack.getItem() == Item.getItemOf(Blocks.AIR)) && itemstack1 != null) {
|
|
itemstack2 = itemstack1.cloneItemStack();
|
|
itemstack2.count = 1;
|
|
@@ -352,6 +377,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) {
|
|
return false;
|
|
} else if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
|