diff options
Diffstat (limited to 'patches/unapplied/server/0170-PlayerPickupExperienceEvent.patch')
-rw-r--r-- | patches/unapplied/server/0170-PlayerPickupExperienceEvent.patch | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/patches/unapplied/server/0170-PlayerPickupExperienceEvent.patch b/patches/unapplied/server/0170-PlayerPickupExperienceEvent.patch new file mode 100644 index 0000000000..272e78a563 --- /dev/null +++ b/patches/unapplied/server/0170-PlayerPickupExperienceEvent.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Tue, 19 Dec 2017 22:02:53 -0500 +Subject: [PATCH] PlayerPickupExperienceEvent + +Allows plugins to cancel a player picking up an experience orb + +diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +index e952aae85a80a020087c3697624c8c13eab3f914..c0c0090ab271dba1cc367e216fea3d9f73e5b887 100644 +--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +@@ -305,7 +305,7 @@ public class ExperienceOrb extends Entity { + @Override + public void playerTouch(Player player) { + if (!this.level.isClientSide) { +- if (player.takeXpDelay == 0) { ++ if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper + player.takeXpDelay = CraftEventFactory.callPlayerXpCooldownEvent(player, 2, PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2; + player.take(this, 1); + int i = this.repairPlayerItems(player, this.value); |