From facae661115fefc6c8341d4069987e218ebda0a1 Mon Sep 17 00:00:00 2001 From: VaiTon Date: Mon, 17 Dec 2018 16:21:20 +0100 Subject: [PATCH] Implements PlayerExpChangeEvent (GlowstoneMC/Glowstone#922) --- src/main/java/net/glowstone/entity/GlowPlayer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/net/glowstone/entity/GlowPlayer.java b/src/main/java/net/glowstone/entity/GlowPlayer.java index 2c6c8018d8..1a3c41bcb5 100644 --- a/src/main/java/net/glowstone/entity/GlowPlayer.java +++ b/src/main/java/net/glowstone/entity/GlowPlayer.java @@ -169,6 +169,7 @@ import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerExpChangeEvent; import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.event.player.PlayerLevelChangeEvent; import org.bukkit.event.player.PlayerPortalEvent; @@ -1697,6 +1698,9 @@ public void setTotalExperience(int exp) { @Override public void giveExp(int xp) { + PlayerExpChangeEvent event = EventFactory.getInstance() + .callEvent(new PlayerExpChangeEvent(this, xp)); + xp = event.getAmount(); totalExperience += xp; // gradually award levels based on xp points