From 0000000000000000000000000000000000000000 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 diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java index f4da22b33c704e675510b4b1a3aa7c180088be29..e3dfb018b06c0139594ddbb88fab2ca8d43ab12f 100644 --- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java @@ -5,6 +5,7 @@ import net.minecraft.core.BlockPosition; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntityExperienceOrb; +import net.minecraft.server.level.EntityPlayer; import net.minecraft.sounds.SoundEffects; import net.minecraft.tags.Tag; import net.minecraft.tags.TagsFluid; @@ -232,7 +233,7 @@ public class EntityExperienceOrb extends Entity { @Override public void pickup(EntityHuman entityhuman) { if (!this.world.isClientSide) { - if (this.d == 0 && entityhuman.bu == 0) { + if (this.d == 0 && entityhuman.bu == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper entityhuman.bu = 2; entityhuman.receive(this, 1); Entry entry = EnchantmentManager.a(Enchantments.MENDING, (EntityLiving) entityhuman, ItemStack::f);