diff options
author | Jake Potrebic <[email protected]> | 2022-03-30 13:28:38 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2022-03-30 13:28:38 -0700 |
commit | 7f47b9b7f84f9bee31b3e046a8dcbd28ec012fe0 (patch) | |
tree | 08dd0cadd782982719e33315c2ae5687b2ce21fb /patches/server/0109-Add-source-to-PlayerExpChangeEvent.patch | |
parent | d3c102373f90cffa1be2a19ce671d99d563ff9ca (diff) | |
download | Paper-7f47b9b7f84f9bee31b3e046a8dcbd28ec012fe0.tar.gz Paper-7f47b9b7f84f9bee31b3e046a8dcbd28ec012fe0.zip |
Remove KeyedObject interface (#7680)
Diffstat (limited to 'patches/server/0109-Add-source-to-PlayerExpChangeEvent.patch')
-rw-r--r-- | patches/server/0109-Add-source-to-PlayerExpChangeEvent.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/patches/server/0109-Add-source-to-PlayerExpChangeEvent.patch b/patches/server/0109-Add-source-to-PlayerExpChangeEvent.patch new file mode 100644 index 0000000000..55ccd362c3 --- /dev/null +++ b/patches/server/0109-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 dba0bc7dc8fd1993f45716a398b1ccf52d3d868b..b3433ce9c722bdab81848a6c2d121ca510c48509 100644 +--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +@@ -247,7 +247,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 b94d6c79adc0858a588778b5ebf9f5e7f97f9050..20e5da655a76ce2024cbbfa00ce4dc924c6cedd0 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -1111,6 +1111,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); + } |