From 533b86c3fc681f599a584f6f9753a78b2f7746e8 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 19 Dec 2017 22:02:53 -0500 Subject: [PATCH] PlayerPickupExperienceEvent Allows plugins to cancel a player picking up an experience orb --- .../net/minecraft/world/entity/ExperienceOrb.java.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ExperienceOrb.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ExperienceOrb.java.patch index ca8ddf1960..518bfe547b 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/ExperienceOrb.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ExperienceOrb.java.patch @@ -177,8 +177,9 @@ @Override public void playerTouch(Player player) { if (player instanceof ServerPlayer entityplayer) { - if (player.takeXpDelay == 0) { +- if (player.takeXpDelay == 0) { - player.takeXpDelay = 2; ++ if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(entityplayer.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - PlayerPickupExperienceEvent + player.takeXpDelay = CraftEventFactory.callPlayerXpCooldownEvent(player, 2, PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2; player.take(this, 1); int i = this.repairPlayerItems(entityplayer, this.value);