Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
36f34f01c0
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: da9ef3c5 #496: Add methods to get/set ItemStacks in EquipmentSlots 3abebc9f #492: Let Tameable extend Animals rather than Entity 941111a0 #495: Expose ItemStack and hand used in PlayerShearEntityEvent 4fe19cae #494: InventoryView - Add missing Brewing FUEL_TIME CraftBukkit Changes:933e9094
#664: Add methods to get/set ItemStacks in EquipmentSlots18722312
#662: Expose ItemStack and hand used in PlayerShearEntityEvent
50 Zeilen
2.6 KiB
Diff
50 Zeilen
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/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
|
index f72bb0c13806c3fadcbbf345f3533c115a200a7f..0447800d9dc341af647a928abd8b79938eddbd6f 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
|
@@ -193,7 +193,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 d739605ded8d81632c491af92322e02b4716c0b1..0c79171ba166846c7136ec6e89fd2a41f99ed260 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
@@ -117,6 +117,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;
|
|
@@ -1012,6 +1013,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);
|
|
}
|