2017-10-05 13:38:21 +00:00
|
|
|
From b9cf0c402f2c29fa10934108747fc075759462eb 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
|
2017-07-09 09:56:36 +00:00
|
|
|
index b200bbf64..ec23eb98c 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
|
|
|
|
@@ -172,7 +172,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
|
2017-07-09 09:56:36 +00:00
|
|
|
index bdeeac36f..7422a91f0 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
|
2016-12-10 00:07:35 +00:00
|
|
|
@@ -45,6 +45,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;
|
|
|
|
import org.bukkit.event.block.*;
|
2017-07-09 09:56:36 +00:00
|
|
|
@@ -647,6 +648,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
|
|
|
|
+
|
|
|
|
public static boolean handleBlockGrowEvent(World world, int x, int y, int z, net.minecraft.server.Block type, int data) {
|
|
|
|
Block block = world.getWorld().getBlockAt(x, y, z);
|
|
|
|
CraftBlockState state = (CraftBlockState) block.getState();
|
|
|
|
--
|
2017-10-05 13:38:21 +00:00
|
|
|
2.14.2
|
2016-11-30 23:31:46 +00:00
|
|
|
|