Class PlayerExperienceLostEvent

java.lang.Object
org.bukkit.event.Event
studio.magemonkey.fabled.api.event.PlayerExperienceLostEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class PlayerExperienceLostEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
Event called when a player loses class experience
  • Constructor Details

    • PlayerExperienceLostEvent

      public PlayerExperienceLostEvent(PlayerClass playerClass, double amount, boolean changeLevel)
      Constructor
      Parameters:
      playerClass - class of the player losing experience
      amount - amount of experience being lost
  • Method Details

    • getPlayerData

      public PlayerData getPlayerData()
      Returns:
      data of the player losing experience
    • getPlayerClass

      public PlayerClass getPlayerClass()
      Returns:
      player's class that is receiving the experience
    • getExp

      public double getExp()
      Returns:
      amount of experience being lost
    • isLevelChangeAllowed

      public boolean isLevelChangeAllowed()
      Returns:
      whether to lower the level if the exp lost exceeds the current exp, or to cap at 0 exp and keep the current level
    • setExp

      public void setExp(int amount)
      Sets the amount of experience being gained
      Parameters:
      amount - new amount of experience
      Throws:
      IllegalArgumentException - if experience is less than 0
    • setLevelChangeAllowed

      public void setLevelChangeAllowed(boolean changeLevel)
      Sets whether to lower the level if the exp lost exceeds the current exp, or to cap at 0 exp and keep the current level
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      whether the gain in experience is cancelled
    • setCancelled

      public void setCancelled(boolean cancelled)
      Sets whether the gain in experience is cancelled
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      cancelled - true/false
    • getHandlers

      public org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
      Returns:
      gets the handlers for the event
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Returns:
      gets the handlers for the event