aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0392-ExperienceOrbMergeEvent.patch
blob: 46f62813a0560f1213b13d71b32b97dec3942016 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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

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 ee28500547c6e069ce8702bfaa095e7a9abcd30d..839deebc72a575eea5db4decd82c8c8b1884e621 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -714,7 +714,7 @@ public class CraftEventFactory {
                 for (Entity e : entities) {
                     if (e instanceof net.minecraft.world.entity.ExperienceOrb loopItem) {
                         // 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) {