aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0405-ExperienceOrbMergeEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0405-ExperienceOrbMergeEvent.patch')
-rw-r--r--patches/server/0405-ExperienceOrbMergeEvent.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/patches/server/0405-ExperienceOrbMergeEvent.patch b/patches/server/0405-ExperienceOrbMergeEvent.patch
new file mode 100644
index 0000000000..1ff06b6779
--- /dev/null
+++ b/patches/server/0405-ExperienceOrbMergeEvent.patch
@@ -0,0 +1,23 @@
+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
+
+Has to be reimplemented at one point maybe
+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 f80bdb38cf377684382bb817fedbeb8d5aae4704..9b94df9940040f51fdcc1af5c7da96117af9017e 100644
+--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+@@ -650,7 +650,7 @@ public class CraftEventFactory {
+ if (e instanceof net.minecraft.world.entity.ExperienceOrb) {
+ net.minecraft.world.entity.ExperienceOrb loopItem = (net.minecraft.world.entity.ExperienceOrb) e;
+ // Paper start
+- if (!loopItem.isRemoved() && !(maxValue > 0 && loopItem.value >= maxValue)) {
++ if (!loopItem.isRemoved() && !(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 - ExperienceOrbMergeEvent
+ long newTotal = (long)xp.value + (long)loopItem.value;
+ if ((int) newTotal < 0) continue; // Overflow
+ if (maxValue > 0 && newTotal > (long)maxValue) {