mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-16 23:55:17 +01:00
d219fd642f
Upstream has released updates that appear 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: 6bff9d09 #508: Add PlayerBucketFishEvent CraftBukkit Changes: a8d7c94a5 SPIGOT-6434: Smithing Table and Anvil inventories .getType() returns CRAFTING c5494d195 #683: Add PlayerBucketFishEvent
50 lines
2.6 KiB
Diff
50 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 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/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java
|
|
index a52cd6d0318e0fee28fc5d252a4b596b92860320..a17812943b5402684c68ddeac5408dc939e42cf6 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java
|
|
@@ -203,7 +203,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 b2f41bc3406d43f71eba270174386d875aecd932..a7c371694a7c6be117501b1dd816acbd304290f5 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
@@ -119,6 +119,7 @@ import org.bukkit.entity.ThrownPotion;
|
|
import org.bukkit.entity.Vehicle;
|
|
import org.bukkit.entity.Villager;
|
|
import org.bukkit.entity.Villager.Profession;
|
|
+import org.bukkit.entity.ExperienceOrb; // Paper
|
|
import org.bukkit.event.Cancellable;
|
|
import org.bukkit.event.Event;
|
|
import org.bukkit.event.Event.Result;
|
|
@@ -1050,6 +1051,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);
|
|
}
|