Class PlayerStatChangeEvent
java.lang.Object
org.bukkit.event.Event
de.marcely.bedwars.api.event.player.PlayerStatChangeEvent
- All Implemented Interfaces:
Cancellable
Gets called whenever a value of a stat has changed in a
PlayerStats.
It's possible that this event might get called async. Keep in mind that this event might get called twice, one for the normal stats and again for the game stats.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionPlayerStatChangeEvent(PlayerStats playerStats, boolean fromRemote, boolean async, String key, Number previous, Number after) -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerListgetKey()Get the key of the stat of who the value might changeGet the new value that's on being planned to be setReturns the previous value that was setgetStats()Get thePlayerStatsin which the new value might get setbooleanGet whether a non-local server has caused the change.voidsetNewValue(Number number) Modify the new value to be something elseMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronousMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bukkit.event.Cancellable
isCancelled, setCancelled
-
Constructor Details
-
PlayerStatChangeEvent
public PlayerStatChangeEvent(PlayerStats playerStats, boolean fromRemote, boolean async, String key, Number previous, Number after)
-
-
Method Details
-
getStats
Get thePlayerStatsin which the new value might get set- Returns:
- The PlayerStats instance involved in this event
-
isFromRemoteServer
public boolean isFromRemoteServer()Get whether a non-local server has caused the change.May be
truewhen the ProxySync addon is used.- Returns:
trueif a non-local server initiated the change
-
getKey
Get the key of the stat of who the value might change- Returns:
- The key of the stat
-
getOldValue
Returns the previous value that was set- Returns:
- The previous value,
0when none was declared before
-
getNewValue
Get the new value that's on being planned to be set- Returns:
- The new value
-
setNewValue
Modify the new value to be something else- Parameters:
number- The new "new value"
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-