Paper/Spigot-Server-Patches/0128-Add-source-to-PlayerExpChangeEvent.patch
Shane Freeder 060bc7bbee
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:
4543fb40 SPIGOT-4943: Zombie villager conversion player API.

CraftBukkit Changes:
585b2ebd Tweak thresholds for can't keep up message
91ada5c2 SPIGOT-4956: EntityTameEvent not triggered when taming a Cat
9bda4134 SPIGOT-4943: Zombie villager conversion player API.
5a027071 SPIGOT-4947: Allow setting the content on a lectern
09d00e9f SPIGOT-4938: Call EntityPickupItemEvent for dolphins
a278e445 SPIGOT-4948: Lectern.getInventory should return a LecternInventory

Spigot Changes:
4f661b22 Rebuild patches
2019-05-19 04:16:22 +01:00

53 lines
2.5 KiB
Diff

From e8f835808fa12ff4f541c2ffb52621c58edd4ae9 Mon Sep 17 00:00:00 2001
From: AlphaBlend <whizkid3000@hotmail.com>
Date: Thu, 8 Sep 2016 08:48:33 -0700
Subject: [PATCH] Add source to PlayerExpChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index b20813be6..bfba08fb2 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -190,7 +190,7 @@ public class EntityExperienceOrb extends Entity {
}
if (this.value > 0) {
- entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value -> event.getAmount()
+ entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this).getAmount()); // CraftBukkit - this.value -> event.getAmount() // Paper - supply experience orb object
}
this.die();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 7471251bc..ca6563096 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -103,6 +103,7 @@ import org.bukkit.entity.Sheep;
import org.bukkit.entity.ThrownExpBottle;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.Vehicle;
+import org.bukkit.entity.ExperienceOrb; // Paper
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Result;
@@ -959,6 +960,17 @@ public class CraftEventFactory {
return event;
}
+ // Paper start - Add orb
+ public static PlayerExpChangeEvent callPlayerExpChangeEvent(EntityHuman entity, EntityExperienceOrb entityOrb) {
+ Player player = (Player) entity.getBukkitEntity();
+ ExperienceOrb source = (ExperienceOrb) entityOrb.getBukkitEntity();
+ int expAmount = source.getExperience();
+ PlayerExpChangeEvent event = new PlayerExpChangeEvent(player, source, expAmount);
+ Bukkit.getPluginManager().callEvent(event);
+ return event;
+ }
+ // Paper end
+
public static boolean handleBlockGrowEvent(World world, BlockPosition pos, IBlockData block) {
return handleBlockGrowEvent(world, pos, block, 3);
}
--
2.21.0