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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerExperienceLostEvent
(PlayerClass playerClass, double amount, boolean changeLevel) Constructor -
Method Summary
Modifier and TypeMethodDescriptiondouble
getExp()
static org.bukkit.event.HandlerList
org.bukkit.event.HandlerList
boolean
boolean
void
setCancelled
(boolean cancelled) Sets whether the gain in experience is cancelledvoid
setExp
(int amount) Sets the amount of experience being gainedvoid
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 levelMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
PlayerExperienceLostEvent
Constructor- Parameters:
playerClass
- class of the player losing experienceamount
- amount of experience being lost
-
-
Method Details
-
getPlayerData
- Returns:
- data of the player losing experience
-
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 interfaceorg.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 interfaceorg.bukkit.event.Cancellable
- Parameters:
cancelled
- true/false
-
getHandlers
public org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlers
in classorg.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
-