Paper/Spigot-Server-Patches/0190-PlayerPickupExperienceEvent.patch
Shane Freeder aba4969668
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
e970fd72 Remove incorrect javadoc from TargetReason
84df6df1 SPIGOT-5282: Improve bucket event API

CraftBukkit Changes:
b2bcde89 SPIGOT-5258: TNT Not Moving Players in Creative Mode
44d675ad SPIGOT-5263: Chests stay open after InventoryOpenEvent cancelled.
2439178e SPIGOT-5278: EntityDrowned memory leak
7055c931 SPIGOT-5264: Call event for experience orbs losing their target
49141172 SPIGOT-5282: Improve bucket event API
6bbb3b04 SPIGOT-5281: Clearer error messages for ChunkSnapshot misuse
2019-08-26 15:36:37 +01:00

24 lines
1.2 KiB
Diff

From 0b8205b527e5acfa6d114903d7f2c5f322871e34 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index 35f03947d..e6b810756 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -222,7 +222,7 @@ public class EntityExperienceOrb extends Entity {
@Override
public void pickup(EntityHuman entityhuman) {
if (!this.world.isClientSide) {
- if (this.d == 0 && entityhuman.bF == 0) {
+ if (this.d == 0 && entityhuman.bF == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper
entityhuman.bF = 2;
entityhuman.receive(this, 1);
Entry<EnumItemSlot, ItemStack> entry = EnchantmentManager.b(Enchantments.MENDING, (EntityLiving) entityhuman);
--
2.23.0