diff options
author | KennyTV <[email protected]> | 2021-06-16 13:07:43 +0200 |
---|---|---|
committer | KennyTV <[email protected]> | 2021-06-16 13:07:43 +0200 |
commit | 2b8d06aed3a19559785c8956d672a9f8a50ca267 (patch) | |
tree | f17e2e849974dcdc3f4922da033a6138aaacb250 /patches/server/0113-Add-source-to-PlayerExpChangeEvent.patch | |
parent | 9e1255cff99dbbf43077985b3884cb2be4b878d6 (diff) | |
download | Paper-2b8d06aed3a19559785c8956d672a9f8a50ca267.tar.gz Paper-2b8d06aed3a19559785c8956d672a9f8a50ca267.zip |
Definitely readd this patch for the first time
Diffstat (limited to 'patches/server/0113-Add-source-to-PlayerExpChangeEvent.patch')
-rw-r--r-- | patches/server/0113-Add-source-to-PlayerExpChangeEvent.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/patches/server/0113-Add-source-to-PlayerExpChangeEvent.patch b/patches/server/0113-Add-source-to-PlayerExpChangeEvent.patch new file mode 100644 index 0000000000..28f8911dc0 --- /dev/null +++ b/patches/server/0113-Add-source-to-PlayerExpChangeEvent.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaBlend <[email protected]> +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/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +index ec47da6c086a6f6640ea2f41d766c900fa992459..919fbe73f46238a1846c969bf64c309f3b9ad9d6 100644 +--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +@@ -246,7 +246,7 @@ public class ExperienceOrb extends Entity { + int i = this.repairPlayerItems(player, this.value); + + if (i > 0) { +- player.giveExperiencePoints(CraftEventFactory.callPlayerExpChangeEvent(player, i).getAmount()); // CraftBukkit - this.value -> event.getAmount() ++ player.giveExperiencePoints(CraftEventFactory.callPlayerExpChangeEvent(player, this).getAmount()); // CraftBukkit - this.value -> event.getAmount() // Paper - supply experience orb object + } + + --this.count; +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index 8e9ae16441057fb5e42154c081f8677f4575587d..2f6aef39f1f9f3da09a596936f57e1cf51c9d6db 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -1057,6 +1057,17 @@ public class CraftEventFactory { + return event; + } + ++ // Paper start - Add orb ++ public static PlayerExpChangeEvent callPlayerExpChangeEvent(net.minecraft.world.entity.player.Player entity, net.minecraft.world.entity.ExperienceOrb 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(Level world, BlockPos pos, net.minecraft.world.level.block.state.BlockState block) { + return CraftEventFactory.handleBlockGrowEvent(world, pos, block, 3); + } |