Class PlayerStatisticChangeEvent<T>

java.lang.Object
org.bukkit.event.Event
dev.despical.tntrun.api.event.TNTRunEvent
dev.despical.tntrun.api.event.player.PlayerEvent
dev.despical.tntrun.api.event.player.PlayerStatisticChangeEvent<T>
Type Parameters:
T - the value type used by the statistic
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class PlayerStatisticChangeEvent<T> extends PlayerEvent implements org.bukkit.event.Cancellable
Called before a player's statistic value is stored.

The event exposes the statistic key, the previous value, and a mutable new value. Listeners may cancel the update or replace the new value before it is written to the User statistic map.

Common use cases:

  • Applying boosters or multipliers
  • Clamping values to a maximum or minimum
  • Rejecting invalid statistic changes
  • Mirroring statistic updates to an external service
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    PlayerStatisticChangeEvent(org.bukkit.entity.Player player, StatisticType<T> stat, T oldValue, T newValue)
    Constructs a new PlayerStatisticChangeEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.event.HandlerList
     
    @NotNull org.bukkit.event.HandlerList
     

    Methods inherited from class PlayerEvent

    getUser, toString

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.bukkit.event.Cancellable

    isCancelled, setCancelled
  • Constructor Details

    • PlayerStatisticChangeEvent

      public PlayerStatisticChangeEvent(org.bukkit.entity.Player player, StatisticType<T> stat, T oldValue, T newValue)
      Constructs a new PlayerStatisticChangeEvent.
      Parameters:
      player - the player whose statistic is changing
      stat - the statistic key being updated
      oldValue - the value stored before the update
      newValue - the value that will be stored unless modified or cancelled
  • Method Details

    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()