geforkt von Mirrors/Paper
b62dfa0bf9
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 39ce5d3a SPIGOT-4399: ItemMeta.equals broken with AttributeModifiers CraftBukkit Changes:1cf8b5dc
SPIGOT-4400: Populators running on existing chunks116cb9a1
SPIGOT-4399: Add attribute modifier equality test5ee1c18a
SPIGOT-4398: Set ASM7_EXPERIMENTAL flag
47 Zeilen
2.4 KiB
Diff
47 Zeilen
2.4 KiB
Diff
From 1efe46f056352cf6f8b11b654093dda41c091ef3 Mon Sep 17 00:00:00 2001
|
|
From: pkt77 <parkerkt77@gmail.com>
|
|
Date: Fri, 10 Nov 2017 23:46:34 -0500
|
|
Subject: [PATCH] Add PlayerArmorChangeEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index b9227f7a7f..f5770884b0 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1,5 +1,6 @@
|
|
package net.minecraft.server;
|
|
|
|
+import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent;
|
|
import com.google.common.base.Objects;
|
|
import com.google.common.collect.Maps;
|
|
import java.util.Collection;
|
|
@@ -2086,6 +2087,13 @@ public abstract class EntityLiving extends Entity {
|
|
ItemStack itemstack1 = this.getEquipment(enumitemslot);
|
|
|
|
if (!ItemStack.matches(itemstack1, itemstack)) {
|
|
+ // Paper start - PlayerArmorChangeEvent
|
|
+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR && !itemstack.getItem().equals(itemstack1.getItem())) {
|
|
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
|
|
+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1);
|
|
+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent();
|
|
+ }
|
|
+ // Paper end
|
|
((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1)));
|
|
if (!itemstack.isEmpty()) {
|
|
this.getAttributeMap().a(itemstack.a(enumitemslot));
|
|
diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java
|
|
index a90ac68c30..49592e5572 100644
|
|
--- a/src/main/java/net/minecraft/server/EnumItemSlot.java
|
|
+++ b/src/main/java/net/minecraft/server/EnumItemSlot.java
|
|
@@ -20,6 +20,7 @@ public enum EnumItemSlot {
|
|
this.j = s1;
|
|
}
|
|
|
|
+ public EnumItemSlot.Function getType() { return this.a(); } // Paper - OBFHELPER
|
|
public EnumItemSlot.Function a() {
|
|
return this.g;
|
|
}
|
|
--
|
|
2.19.0
|
|
|