mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
1718f61bf8
Doesn't compile yet. CraftBukkit Changes: 90d6905b Repackage NMS 69cf961d Repackage patches Spigot Changes: 79d53c28 Repackage NMS
44 lines
2.3 KiB
Diff
44 lines
2.3 KiB
Diff
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/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
index 851aed157a233ab690a57e5736fa01beaff45b5c..1dcdf9e328670b42d656e8ab65cb3da8a2312fe6 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
@@ -1,5 +1,6 @@
|
|
package net.minecraft.world.entity;
|
|
|
|
+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;
|
|
@@ -2646,6 +2647,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) {
|
|
+ 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/world/entity/EnumItemSlot.java b/src/main/java/net/minecraft/world/entity/EnumItemSlot.java
|
|
index 8e7673c6072c3f8ddcebd7a719304ea41d809a36..59ad7d8dc1c8ee00d142dc6063c3416ccdce4ff8 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EnumItemSlot.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/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;
|
|
}
|