2019-01-01 03:15:55 +00:00
|
|
|
From 9b665d86432862f20fd8925e96574778337696fd Mon Sep 17 00:00:00 2001
|
2016-11-30 23:31:46 +00:00
|
|
|
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
|
2018-12-17 05:18:06 +00:00
|
|
|
index 808d1a120..3030dd9c3 100644
|
2016-11-30 23:31:46 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
2018-07-16 20:08:09 +00:00
|
|
|
@@ -185,7 +185,7 @@ public class EntityExperienceOrb extends Entity {
|
|
|
|
}
|
2016-11-30 23:31:46 +00:00
|
|
|
|
|
|
|
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
|
2019-01-01 03:15:55 +00:00
|
|
|
index b8bf1fbef..717cd0f42 100644
|
2016-11-30 23:31:46 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
2018-12-08 10:09:55 +00:00
|
|
|
@@ -51,6 +51,7 @@ import org.bukkit.entity.Player;
|
2016-11-30 23:31:46 +00:00
|
|
|
import org.bukkit.entity.Projectile;
|
|
|
|
import org.bukkit.entity.ThrownExpBottle;
|
|
|
|
import org.bukkit.entity.ThrownPotion;
|
|
|
|
+import org.bukkit.entity.ExperienceOrb; // Paper
|
|
|
|
import org.bukkit.event.Cancellable;
|
|
|
|
import org.bukkit.event.Event;
|
2018-11-03 00:23:27 +00:00
|
|
|
import org.bukkit.event.Event.Result;
|
2019-01-01 03:15:55 +00:00
|
|
|
@@ -833,6 +834,17 @@ public class CraftEventFactory {
|
2016-11-30 23:31:46 +00:00
|
|
|
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
|
|
|
|
+
|
2018-07-16 20:08:09 +00:00
|
|
|
public static boolean handleBlockGrowEvent(World world, BlockPosition pos, IBlockData block) {
|
|
|
|
return handleBlockGrowEvent(world, pos, block, 3);
|
|
|
|
}
|
2016-11-30 23:31:46 +00:00
|
|
|
--
|
2019-01-01 03:15:55 +00:00
|
|
|
2.20.1
|
2016-11-30 23:31:46 +00:00
|
|
|
|