Skip to content

Commit

Permalink
Implements PlayerExpChangeEvent (GlowstoneMC#922)
Browse files Browse the repository at this point in the history
  • Loading branch information
VaiTon committed Dec 17, 2018
1 parent 506ad22 commit facae66
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/net/glowstone/entity/GlowPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit facae66

Please sign in to comment.