aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0169-PlayerPickupExperienceEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0169-PlayerPickupExperienceEvent.patch')
-rw-r--r--patches/server/0169-PlayerPickupExperienceEvent.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/patches/server/0169-PlayerPickupExperienceEvent.patch b/patches/server/0169-PlayerPickupExperienceEvent.patch
new file mode 100644
index 0000000000..f59d0999a5
--- /dev/null
+++ b/patches/server/0169-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 16a1a005f2dda30cf804bf51638383ef3bfeb43e..80f4dfdbc410aa3346897e2ca63272a081712b6e 100644
+--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
++++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+@@ -303,7 +303,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 = 2;
+ player.take(this, 1);
+ int i = this.repairPlayerItems(player, this.value);