geforkt von Mirrors/Paper
094bb03a37
- Lots of itemstack cloning removed. Only clone if the item is actually moved - Return true when a plugin cancels inventory move item event instead of false, as false causes pulls to cycle through all items. However, pushes do not exhibit the same behavior, so this is not something plugins could of been relying on. - Add option (Default on) to cooldown hoppers when they fail to move an item due to full inventory - Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration
47 Zeilen
2.3 KiB
Diff
47 Zeilen
2.3 KiB
Diff
From 2ae8791e2ee4b302d1878c24e8cc369d1d0e6c74 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 4e7cf5de6..b65b88586 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;
|
|
@@ -1930,6 +1931,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 cdf3a3ba4..be5d0bf89 100644
|
|
--- 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;
|
|
}
|
|
--
|
|
2.16.1
|
|
|