Class PlayerStatChangeEvent

java.lang.Object
org.bukkit.event.Event
de.marcely.bedwars.api.event.player.PlayerStatChangeEvent
All Implemented Interfaces:
Cancellable

public class PlayerStatChangeEvent extends Event implements 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.

  • Constructor Details

    • PlayerStatChangeEvent

      public PlayerStatChangeEvent(PlayerStats playerStats, boolean fromRemote, boolean async, String key, Number previous, Number after)
  • Method Details

    • getStats

      public PlayerStats getStats()
      Get the PlayerStats 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

      public String getKey()
      Get the key of the stat of who the value might change
      Returns:
      The key of the stat
    • getOldValue

      public Number getOldValue()
      Returns the previous value that was set
      Returns:
      The previous value, 0 when none was declared before
    • getNewValue

      public Number getNewValue()
      Get the new value that's on being planned to be set
      Returns:
      The new value
    • setNewValue

      public void setNewValue(Number number)
      Modify the new value to be something else
      Parameters:
      number - The new "new value"
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()