diff options
Diffstat (limited to 'Spigot-Server-Patches-Unmapped/0183-ExperienceOrbMergeEvent.patch')
-rw-r--r-- | Spigot-Server-Patches-Unmapped/0183-ExperienceOrbMergeEvent.patch | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Spigot-Server-Patches-Unmapped/0183-ExperienceOrbMergeEvent.patch b/Spigot-Server-Patches-Unmapped/0183-ExperienceOrbMergeEvent.patch new file mode 100644 index 0000000000..069f71f2af --- /dev/null +++ b/Spigot-Server-Patches-Unmapped/0183-ExperienceOrbMergeEvent.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Tue, 19 Dec 2017 22:57:26 -0500 +Subject: [PATCH] ExperienceOrbMergeEvent + +Fired when the server is about to merge 2 experience orbs +Plugins can cancel this if they want to ensure experience orbs do not lose important +metadata such as spawn reason, or conditionally move data from source to target. + +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index 62f43cc1ba7acb8886dbaf4dd993e52327586fa0..94a9ac289d858629684e2b98982c5c54b59efd0b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -588,7 +588,7 @@ public class CraftEventFactory { + if (e instanceof EntityExperienceOrb) { + EntityExperienceOrb loopItem = (EntityExperienceOrb) e; + // Paper start +- if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) { ++ if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue) && new com.destroystokyo.paper.event.entity.ExperienceOrbMergeEvent((org.bukkit.entity.ExperienceOrb) entity.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) loopItem.getBukkitEntity()).callEvent()) { // Paper + long newTotal = (long)xp.value + (long)loopItem.value; + if ((int) newTotal < 0) continue; // Overflow + if (maxValue > 0 && newTotal > (long)maxValue) { |