Package me.kzlyth.api.statistics.global
Klasse GlobalStatisticsAPI
java.lang.Object
me.kzlyth.api.statistics.global.GlobalStatisticsAPI
API for retrieving global statistics from Zenith-Mod.
This API provides methods to access global statistics including:
- Total registered users
- Online player count
- Banned and muted player counts
- Total punishments, bans, mutes, warns, kicks
- Total notes
Database Compatibility: All methods in this API are fully compatible with H2, SQLite, MySQL, and MariaDB databases. The API automatically adapts to the configured database type from the configuration file.
Example usage:
ZenithAPI api = ZenithAPI.getInstance();
if (api != null) {
GlobalStatisticsAPI globalStats = api.getStatisticsAPI().getGlobalStatistics();
// Get total users
globalStats.getTotalUsers().thenAccept(total -> {
getLogger().info("Total registered users: " + total);
});
// Get total punishments
globalStats.getTotalPunishments().thenAccept(total -> {
getLogger().info("Total punishments: " + total);
});
}
- Seit:
- 1.2.3
- Autor:
- Zenith-Studios
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungGlobalStatisticsAPI(@NotNull me.kzlyth.ZenithMod plugin, @NotNull ZenithAPI api) Constructs a new GlobalStatisticsAPI instance. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibung@NotNull CompletableFuture<Integer> Gets the total number of banned players (account bans only, not IP bans).@NotNull CompletableFuture<Integer> Gets the total number of IP-banned players.@NotNull CompletableFuture<Integer> Gets the total number of IP-muted players.@NotNull CompletableFuture<Integer> Gets the total number of muted players (account mutes only, not IP mutes).@NotNull CompletableFuture<Integer> Gets the total number of online players currently on the server.@NotNull CompletableFuture<Integer> Gets the total number of ban punishments in the history.@NotNull CompletableFuture<Integer> Gets the total number of kick punishments in the history.@NotNull CompletableFuture<Integer> Gets the total number of mute punishments in the history.@NotNull CompletableFuture<Integer> Gets the total number of notes in the database.@NotNull CompletableFuture<Integer> Gets the total number of punishment entries in the history.@NotNull CompletableFuture<Integer> Gets the total number of registered users in the database.@NotNull CompletableFuture<Integer> Gets the total number of warn punishments in the history.
-
Konstruktordetails
-
GlobalStatisticsAPI
public GlobalStatisticsAPI(@NotNull @NotNull me.kzlyth.ZenithMod plugin, @NotNull @NotNull ZenithAPI api) Constructs a new GlobalStatisticsAPI instance.- Parameter:
plugin- The plugin instanceapi- The main API instance
-
-
Methodendetails
-
getTotalUsers
Gets the total number of registered users in the database.Example:
globalStats.getTotalUsers().thenAccept(total -> { getLogger().info("Total registered users: " + total); });- Gibt zurück:
- A CompletableFuture that completes with the total number of registered users
-
getOnlineCount
Gets the total number of online players currently on the server.Example:
globalStats.getOnlineCount().thenAccept(count -> { getLogger().info("Online players: " + count); });- Gibt zurück:
- A CompletableFuture that completes with the number of online players
-
getBannedCount
Gets the total number of banned players (account bans only, not IP bans).Example:
globalStats.getBannedCount().thenAccept(count -> { getLogger().info("Banned players: " + count); });- Gibt zurück:
- A CompletableFuture that completes with the number of banned players
-
getIpBannedCount
Gets the total number of IP-banned players.Example:
globalStats.getIpBannedCount().thenAccept(count -> { getLogger().info("IP-banned players: " + count); });- Gibt zurück:
- A CompletableFuture that completes with the number of IP-banned players
-
getMutedCount
Gets the total number of muted players (account mutes only, not IP mutes).Example:
globalStats.getMutedCount().thenAccept(count -> { getLogger().info("Muted players: " + count); });- Gibt zurück:
- A CompletableFuture that completes with the number of muted players
-
getIpMutedCount
Gets the total number of IP-muted players.Example:
globalStats.getIpMutedCount().thenAccept(count -> { getLogger().info("IP-muted players: " + count); });- Gibt zurück:
- A CompletableFuture that completes with the number of IP-muted players
-
getTotalPunishments
Gets the total number of punishment entries in the history.This includes all punishment types (BAN, MUTE, WARN, KICK, etc.) but excludes removal actions like UNBAN and UNMUTE.
Example:
globalStats.getTotalPunishments().thenAccept(total -> { getLogger().info("Total punishments: " + total); });- Gibt zurück:
- A CompletableFuture that completes with the total number of punishments
-
getTotalBans
Gets the total number of ban punishments in the history.Example:
globalStats.getTotalBans().thenAccept(count -> { getLogger().info("Total bans: " + count); });- Gibt zurück:
- A CompletableFuture that completes with the total number of bans
-
getTotalMutes
Gets the total number of mute punishments in the history.Example:
globalStats.getTotalMutes().thenAccept(count -> { getLogger().info("Total mutes: " + count); });- Gibt zurück:
- A CompletableFuture that completes with the total number of mutes
-
getTotalWarns
Gets the total number of warn punishments in the history.Example:
globalStats.getTotalWarns().thenAccept(count -> { getLogger().info("Total warns: " + count); });- Gibt zurück:
- A CompletableFuture that completes with the total number of warns
-
getTotalKicks
Gets the total number of kick punishments in the history.Example:
globalStats.getTotalKicks().thenAccept(count -> { getLogger().info("Total kicks: " + count); });- Gibt zurück:
- A CompletableFuture that completes with the total number of kicks
-
getTotalNotes
Gets the total number of notes in the database.Example:
globalStats.getTotalNotes().thenAccept(count -> { getLogger().info("Total notes: " + count); });- Gibt zurück:
- A CompletableFuture that completes with the total number of notes
-