mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
24 lines
1.8 KiB
Diff
24 lines
1.8 KiB
Diff
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 fb490fa7d59b1099e34a5adc7993d6dad2f10932..113e4db1d66b7af5b2ba976d094b4bf548b5800e 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
@@ -650,7 +650,7 @@ public class CraftEventFactory {
|
|
if (e instanceof net.minecraft.world.entity.ExperienceOrb) {
|
|
net.minecraft.world.entity.ExperienceOrb loopItem = (net.minecraft.world.entity.ExperienceOrb) e;
|
|
// 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) {
|