aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0894-ExperienceOrb-should-call-EntitySpawnEvent.patch
blob: cc8338c2f54452fe6e03d5ac38a042d8db7ea73a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Golfing8 <atroo@me.com>
Date: Mon, 8 May 2023 09:18:17 -0400
Subject: [PATCH] ExperienceOrb should call EntitySpawnEvent


diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index cd6ee371910328d4ab6f4a018fa0e4a48dbc7982..ebb39bd51dceab1d55eea81d33273af21acfc69b 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -735,7 +735,8 @@ public class CraftEventFactory {
         // Spigot start - SPIGOT-7523: Merge after spawn event and only merge if the event was not cancelled (gets checked above)
         if (entity instanceof net.minecraft.world.entity.ExperienceOrb xp) {
             double radius = world.spigotConfig.expMerge;
-            if (radius > 0) {
+            event = CraftEventFactory.callEntitySpawnEvent(entity); // Call spawn event for ExperienceOrb entities
+            if (radius > 0 && !event.isCancelled() && !entity.isRemoved()) {
                 // Paper start - Maximum exp value when merging; Whole section has been tweaked, see comments for specifics
                 final int maxValue = world.paperConfig().entities.behavior.experienceMergeMaxValue;
                 final boolean mergeUnconditionally = world.paperConfig().entities.behavior.experienceMergeMaxValue <= 0;