Paper/Spigot-Server-Patches/0191-ExperienceOrbMergeEvent.patch
Shane Freeder c9fd745840
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
ff0672ca SPIGOT-5211: Add Raid API

CraftBukkit Changes:
96bc85f0 SPIGOT-5298: Remove unexplained 0.1 drop chance offset
6ed8a189 SPIGOT-5290: Invulnerable and/or Marker armor stand triggers EntityDamageEvent
631eaeb0 SPIGOT-5297: PlayerBedLeaveEvent.getBed() returns player location
8d4bc541 SPIGOT-5293: Sponge behaviour differs from Vanilla
e91fd75e SPIGOT-5291: Missing event for ravagers trampling crops
cbdd7139 SPIGOT-5211: Add Raid API
edd8fdfb SPIGOT-5287: Fix rare CME generating new chunks
3fc97f08 SPIGOT-5265: FireworkExplodeEvent only fired when rockets explode in air

Spigot Changes:
065a3734 Rebuild patches
a5961826 SPIGOT-5286: tick-inactive-villagers invokes the AI for NoAI villagers
2019-08-31 20:30:44 +01:00

26 lines
1.6 KiB
Diff

From 782fe85c988f7dff4bd866321a742aad5865e93d Mon Sep 17 00:00:00 2001
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.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 5257941e9..489943410 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -547,7 +547,7 @@ public class CraftEventFactory {
if (e instanceof EntityExperienceOrb) {
EntityExperienceOrb loopItem = (EntityExperienceOrb) e;
// Paper start
- if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) {
+ 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
long newTotal = (long)xp.value + (long)loopItem.value;
if ((int) newTotal < 0) continue; // Overflow
if (maxValue > 0 && newTotal > (long)maxValue) {
--
2.23.0