geforkt von Mirrors/Paper
53 Zeilen
2.4 KiB
Diff
53 Zeilen
2.4 KiB
Diff
--- a/net/minecraft/server/EntityArmorStand.java
|
|
+++ b/net/minecraft/server/EntityArmorStand.java
|
|
@@ -4,6 +4,15 @@
|
|
import java.util.Arrays;
|
|
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 bp = new Vector3f(0.0F, 0.0F, 0.0F);
|
|
@@ -360,6 +369,21 @@
|
|
if (itemstack1 == null || (this.bz & 1 << enumitemslot.c() + 8) == 0) {
|
|
if (itemstack1 != null || (this.bz & 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 == null || itemstack1.getItem() == Item.getItemOf(Blocks.AIR)) && itemstack != null) {
|
|
itemstack2 = itemstack.cloneItemStack();
|
|
@@ -381,6 +405,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();
|