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
ConstructorsConstructorDescriptionPlayerStatisticChangeEvent(org.bukkit.entity.Player player, StatisticType<T> stat, T oldValue, T newValue) Constructs a new PlayerStatisticChangeEvent. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerListMethods inherited from class PlayerEvent
getUser, toStringMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronousMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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 changingstat- the statistic key being updatedoldValue- the value stored before the updatenewValue- the value that will be stored unless modified or cancelled
-
-
Method Details
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlersin classorg.bukkit.event.Event
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()
-