mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 06:24:06 +01:00
7f9b65035a
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: fe0cadf0 Add BlockShearEntityEvent for Dispensers shearing Sheep 90e5cca3 SPIGOT-4892: Allow to set the currently viewed page of a book on a lectern inventory a30337f7 SPIGOT-4887: Villager level minimum is 1 d88d828c SPIGOT-4886: Villager type SNOWY should be named SNOW CraftBukkit Changes:6ceffb0d
SPIGOT-4895: Bed doesn't explode in Nether and The Endee881847
SPIGOT-4888: setSleepingIgnored resets the night even when there is no one in a bed15e02b40
SPIGOT-4890: EntityDeathEvent fires twice when breaking an armor stand in survival modeb38a3c33
Add BlockShearEntityEvent for Dispensers shearing Sheep70ebefca
SPIGOT-4891: LecternInventory.getType() should return InventoryType.LECTERN0036d1b7
SPIGOT-4887: Villager level minimum is 1
53 lines
2.5 KiB
Diff
53 lines
2.5 KiB
Diff
From 5fe55301db1583c6c925e28bd39a3672471539ea 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 e67b4cbac..0441afce9 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
@@ -102,6 +102,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;
|
|
@@ -957,6 +958,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
|
|
|