2019-06-14 02:27:40 +00:00
|
|
|
From 443f117aa22831c4a72932a4d3f831c09821f84c Mon Sep 17 00:00:00 2001
|
2017-12-20 03:57:46 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
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.
|
|
|
|
|
2018-12-17 05:18:06 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
2019-05-27 10:57:28 +00:00
|
|
|
index 123cefd47c..12d4300437 100644
|
2018-12-17 05:18:06 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
2019-05-27 10:57:28 +00:00
|
|
|
@@ -539,7 +539,7 @@ public class CraftEventFactory {
|
2017-12-20 03:57:46 +00:00
|
|
|
if (e instanceof EntityExperienceOrb) {
|
|
|
|
EntityExperienceOrb loopItem = (EntityExperienceOrb) e;
|
2018-08-03 04:06:20 +00:00
|
|
|
// Paper start
|
|
|
|
- if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) {
|
2018-12-17 05:18:06 +00:00
|
|
|
+ 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
|
2018-08-03 04:06:20 +00:00
|
|
|
long newTotal = (long)xp.value + (long)loopItem.value;
|
2018-08-04 00:59:35 +00:00
|
|
|
if ((int) newTotal < 0) continue; // Overflow
|
|
|
|
if (maxValue > 0 && newTotal > (long)maxValue) {
|
2017-12-20 03:57:46 +00:00
|
|
|
--
|
2019-03-20 01:46:00 +00:00
|
|
|
2.21.0
|
2017-12-20 03:57:46 +00:00
|
|
|
|