2020-06-25 15:11:48 +02:00
|
|
|
From 0000000000000000000000000000000000000000 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
|
2020-11-18 04:45:18 +01:00
|
|
|
index 2fe60df578ad7d6087ae86759f22421a25e5258d..0bfc3a7a532a166497eff75ed355f05c96e216c4 100644
|
2020-06-25 15:11:48 +02:00
|
|
|
--- 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; // Paper
|
|
|
|
import com.google.common.base.Objects;
|
|
|
|
import com.google.common.collect.ImmutableList;
|
|
|
|
import com.google.common.collect.ImmutableMap;
|
2020-09-11 01:47:58 +02:00
|
|
|
@@ -2534,6 +2535,13 @@ public abstract class EntityLiving extends Entity {
|
2020-06-25 15:11:48 +02:00
|
|
|
ItemStack itemstack1 = this.getEquipment(enumitemslot);
|
|
|
|
|
|
|
|
if (!ItemStack.matches(itemstack1, itemstack)) {
|
|
|
|
+ // Paper start - PlayerArmorChangeEvent
|
|
|
|
+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
|
|
|
|
+ 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
|
|
|
|
if (map == null) {
|
|
|
|
map = Maps.newEnumMap(EnumItemSlot.class);
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java
|
2020-09-11 01:47:58 +02:00
|
|
|
index 8862603d40ae6048345ef4cf34016c96fa12f76e..3ad9b3e69ef0ed8ad8eebcb323024670ce7599d1 100644
|
2020-06-25 15:11:48 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EnumItemSlot.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EnumItemSlot.java
|
|
|
|
@@ -16,6 +16,7 @@ public enum EnumItemSlot {
|
|
|
|
this.j = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public EnumItemSlot.Function getType() { return this.a(); } // Paper - OBFHELPER
|
|
|
|
public EnumItemSlot.Function a() {
|
|
|
|
return this.g;
|
|
|
|
}
|