2017-11-11 05:46:55 +01: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-05-06 11:48:49 +02:00
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
2017-11-11 05:46:55 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
@@ -0,0 +0,0 @@
|
|
|
|
package net.minecraft.server;
|
|
|
|
|
2020-06-25 15:11:48 +02:00
|
|
|
+import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; // Paper
|
2017-11-11 05:46:55 +01:00
|
|
|
import com.google.common.base.Objects;
|
2019-04-28 01:23:53 +02:00
|
|
|
import com.google.common.collect.ImmutableList;
|
2020-06-25 15:11:48 +02:00
|
|
|
import com.google.common.collect.ImmutableMap;
|
2017-11-11 05:46:55 +01:00
|
|
|
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
2020-06-25 15:11:48 +02:00
|
|
|
ItemStack itemstack1 = this.getEquipment(enumitemslot);
|
2017-11-11 05:46:55 +01:00
|
|
|
|
2020-06-25 15:11:48 +02:00
|
|
|
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);
|
|
|
|
}
|
2017-11-11 06:07:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
2017-11-11 06:07:45 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EnumItemSlot.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EnumItemSlot.java
|
|
|
|
@@ -0,0 +0,0 @@ public enum EnumItemSlot {
|
2019-01-01 04:15:55 +01:00
|
|
|
this.j = s;
|
2017-11-11 06:07:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+ public EnumItemSlot.Function getType() { return this.a(); } // Paper - OBFHELPER
|
|
|
|
public EnumItemSlot.Function a() {
|
|
|
|
return this.g;
|
|
|
|
}
|