2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Tue, 19 Dec 2017 22:57:26 -0500
|
|
|
|
Subject: [PATCH] ExperienceOrbMergeEvent
|
2021-06-14 07:37:57 +02:00
|
|
|
|
2021-06-12 17:06:20 +02:00
|
|
|
Has to be reimplemented at one point maybe
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
2023-04-07 20:39:13 +02:00
|
|
|
index 5f61fe52c6fc15c3114a6ba44eea6d219228f26e..6045ebda7250545c255c1e1c1eb614deff3dfc96 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
2023-04-07 20:39:13 +02:00
|
|
|
@@ -656,7 +656,7 @@ public class CraftEventFactory {
|
2021-06-11 14:02:28 +02:00
|
|
|
if (e instanceof net.minecraft.world.entity.ExperienceOrb) {
|
|
|
|
net.minecraft.world.entity.ExperienceOrb loopItem = (net.minecraft.world.entity.ExperienceOrb) e;
|
|
|
|
// Paper start
|
2021-06-14 07:37:57 +02:00
|
|
|
- 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
|
2021-06-11 14:02:28 +02:00
|
|
|
long newTotal = (long)xp.value + (long)loopItem.value;
|
|
|
|
if ((int) newTotal < 0) continue; // Overflow
|
|
|
|
if (maxValue > 0 && newTotal > (long)maxValue) {
|