Class PlayerStatistics
java.lang.Object
com.github.darksoulq.abyssallib.world.data.statistic.PlayerStatistics
Manages the loading, storing, and tracking of individual player statistics safely
integrated with a local relational database instance.
-
Method Summary
Modifier and TypeMethodDescriptionintGets the current integer value of a specified statistic.getAll()Retrieves an immutable copy of the active in-memory statistics cache.voidIncrements the tracked value of a specified statistic safely dispatching events.static voidinit()Initializes the statistics database connection and ensures the necessary tables exist.static PlayerStatisticsof(org.bukkit.entity.Player player) Retrieves the statistics cache wrapper for a specific player.voidOverwrites the tracked value of a specified statistic and synchronizes it to the database.
-
Method Details
-
init
-
of
Retrieves the statistics cache wrapper for a specific player.- Parameters:
player- The Bukkit player.- Returns:
- The bound PlayerStatistics instance.
-
get
Gets the current integer value of a specified statistic.- Parameters:
stat- The target statistic.- Returns:
- The tracked value, or 0 if unrecorded.
-
increment
Increments the tracked value of a specified statistic safely dispatching events.- Parameters:
stat- The target statistic.amount- The integer amount to append.
-
set
Overwrites the tracked value of a specified statistic and synchronizes it to the database.- Parameters:
stat- The target statistic.newValue- The exact new integer value to set.
-
getAll
-