mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Add source to PlayerExpChangeEvent
This commit is contained in:
parent
76de1e898e
commit
087a701e69
@ -84,7 +84,7 @@
|
||||
|
||||
if (i > 0) {
|
||||
- player.giveExperiencePoints(i);
|
||||
+ 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;
|
||||
|
@ -1168,6 +1168,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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user