2020-01-22 03:02:07 +01:00
|
|
|
From 520d201ae95118a130e5bf74a3fefe6e757a9524 Mon Sep 17 00:00:00 2001
|
2016-12-01 00:31:46 +01: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
|
2019-12-12 00:43:22 +01:00
|
|
|
index f72bb0c13..0447800d9 100644
|
2016-12-01 00:31:46 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
2019-08-26 16:25:58 +02:00
|
|
|
@@ -193,7 +193,7 @@ public class EntityExperienceOrb extends Entity {
|
2018-07-16 22:08:09 +02:00
|
|
|
}
|
2016-12-01 00:31:46 +01: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
|
2020-01-14 22:43:50 +01:00
|
|
|
index 2d454a3c3..95973558e 100644
|
2016-12-01 00:31:46 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
2019-08-31 21:30:44 +02:00
|
|
|
@@ -111,6 +111,7 @@ import org.bukkit.entity.ThrownPotion;
|
2019-04-27 08:26:04 +02:00
|
|
|
import org.bukkit.entity.Vehicle;
|
2019-05-27 12:57:28 +02:00
|
|
|
import org.bukkit.entity.Villager;
|
|
|
|
import org.bukkit.entity.Villager.Profession;
|
2016-12-01 00:31:46 +01:00
|
|
|
+import org.bukkit.entity.ExperienceOrb; // Paper
|
|
|
|
import org.bukkit.event.Cancellable;
|
|
|
|
import org.bukkit.event.Event;
|
2018-11-03 01:23:27 +01:00
|
|
|
import org.bukkit.event.Event.Result;
|
2020-01-14 22:43:50 +01:00
|
|
|
@@ -1004,6 +1005,17 @@ public class CraftEventFactory {
|
2016-12-01 00:31:46 +01: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 22:08:09 +02:00
|
|
|
public static boolean handleBlockGrowEvent(World world, BlockPosition pos, IBlockData block) {
|
|
|
|
return handleBlockGrowEvent(world, pos, block, 3);
|
|
|
|
}
|
2016-12-01 00:31:46 +01:00
|
|
|
--
|
2020-01-22 03:02:07 +01:00
|
|
|
2.25.0.windows.1
|
2016-12-01 00:31:46 +01:00
|
|
|
|