Klasse GlobalStatisticsAPI

java.lang.Object
me.kzlyth.api.statistics.global.GlobalStatisticsAPI

public class GlobalStatisticsAPI extends Object
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
  • Konstruktordetails

    • GlobalStatisticsAPI

      public GlobalStatisticsAPI(@NotNull @NotNull me.kzlyth.ZenithMod plugin, @NotNull @NotNull ZenithAPI api)
      Constructs a new GlobalStatisticsAPI instance.
      Parameter:
      plugin - The plugin instance
      api - The main API instance
  • Methodendetails

    • getTotalUsers

      @NotNull public @NotNull CompletableFuture<Integer> 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

      @NotNull public @NotNull CompletableFuture<Integer> 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

      @NotNull public @NotNull CompletableFuture<Integer> 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

      @NotNull public @NotNull CompletableFuture<Integer> 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

      @NotNull public @NotNull CompletableFuture<Integer> 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

      @NotNull public @NotNull CompletableFuture<Integer> 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

      @NotNull public @NotNull CompletableFuture<Integer> 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

      @NotNull public @NotNull CompletableFuture<Integer> 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

      @NotNull public @NotNull CompletableFuture<Integer> 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

      @NotNull public @NotNull CompletableFuture<Integer> 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

      @NotNull public @NotNull CompletableFuture<Integer> 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

      @NotNull public @NotNull CompletableFuture<Integer> 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