Package me.kzlyth.api.statistics
Klasse StatisticsAPI
java.lang.Object
me.kzlyth.api.statistics.StatisticsAPI
Main API class for retrieving statistics from Zenith-Mod.
This API provides access to all statistics functionality through specialized sub-APIs:
GlobalStatisticsAPI- Global statistics (total users, punishments, etc.)UserStatisticsAPI- User-specific statistics (punishments received)StaffStatisticsAPI- Staff statistics (punishments given)
Example usage:
ZenithAPI api = ZenithAPI.getInstance();
if (api != null) {
StatisticsAPI statisticsAPI = api.getStatisticsAPI();
// Get global statistics
GlobalStatisticsAPI globalStats = statisticsAPI.getGlobalStatistics();
globalStats.getTotalUsers().thenAccept(total -> {
getLogger().info("Total registered users: " + total);
});
// Get user statistics
UserStatisticsAPI userStats = statisticsAPI.getUserStatistics();
UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000");
userStats.getPunishmentCount(uuid).thenAccept(count -> {
getLogger().info("User has received " + count + " punishments");
});
// Get staff statistics
StaffStatisticsAPI staffStats = statisticsAPI.getStaffStatistics();
staffStats.getPunishmentsGiven(uuid).thenAccept(count -> {
getLogger().info("Staff member has given " + count + " punishments");
});
}
- Seit:
- 1.2.3
- Autor:
- Zenith-Studios
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungStatisticsAPI(@NotNull me.kzlyth.ZenithMod plugin, @NotNull ZenithAPI api) Constructs a new StatisticsAPI instance. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibung@NotNull GlobalStatisticsAPIGets the global statistics API instance.@NotNull StaffStatisticsAPIGets the staff statistics API instance.@NotNull UserStatisticsAPIGets the user statistics API instance.
-
Konstruktordetails
-
StatisticsAPI
Constructs a new StatisticsAPI instance.- Parameter:
plugin- The plugin instanceapi- The main API instance
-
-
Methodendetails
-
getGlobalStatistics
Gets the global statistics API instance.The global statistics API provides methods to retrieve global statistics including total users, online count, banned/muted counts, and total punishments.
Example:
StatisticsAPI statisticsAPI = api.getStatisticsAPI(); GlobalStatisticsAPI globalStats = statisticsAPI.getGlobalStatistics(); globalStats.getTotalUsers().thenAccept(total -> { getLogger().info("Total registered users: " + total); }); globalStats.getTotalPunishments().thenAccept(total -> { getLogger().info("Total punishments: " + total); });- Gibt zurück:
- The global statistics API instance
-
getUserStatistics
Gets the user statistics API instance.The user statistics API provides methods to retrieve statistics about punishments a user has received, including bans, mutes, warns, kicks, and notes.
Example:
StatisticsAPI statisticsAPI = api.getStatisticsAPI(); UserStatisticsAPI userStats = statisticsAPI.getUserStatistics(); UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000"); userStats.getPunishmentCount(uuid).thenAccept(count -> { getLogger().info("User has received " + count + " punishments"); }); userStats.getBanCount(uuid).thenAccept(count -> { getLogger().info("User has been banned " + count + " times"); });- Gibt zurück:
- The user statistics API instance
-
getStaffStatistics
Gets the staff statistics API instance.The staff statistics API provides methods to retrieve statistics about punishments a user has given as a staff member, including bans, mutes, warns, kicks, and notes written.
Example:
StatisticsAPI statisticsAPI = api.getStatisticsAPI(); StaffStatisticsAPI staffStats = statisticsAPI.getStaffStatistics(); UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000"); staffStats.getPunishmentsGiven(uuid).thenAccept(count -> { getLogger().info("Staff member has given " + count + " punishments"); }); staffStats.getBansGiven(uuid).thenAccept(count -> { getLogger().info("Staff member has given " + count + " bans"); });- Gibt zurück:
- The staff statistics API instance
-