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
ConstructorDescriptionPlayerStatChangeEvent
(PlayerStats playerStats, boolean fromRemote, boolean async, String key, Number previous, Number after) -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerList
getKey()
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 thePlayerStats
in which the new value might get setboolean
Get whether a non-local server has caused the change.void
setNewValue
(Number number) Modify the new value to be something elseMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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 thePlayerStats
in 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
true
when the ProxySync addon is used.- Returns:
true
if 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,
0
when 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:
getHandlers
in classEvent
-
getHandlerList
-