Klasse UserStatisticsAPI

java.lang.Object
me.kzlyth.api.statistics.user.UserStatisticsAPI

public class UserStatisticsAPI extends Object
API for retrieving user-specific statistics from Zenith-Mod.

This API provides methods to access statistics about punishments a user has received, including bans, mutes, warns, kicks, and 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) {
     UserStatisticsAPI userStats = api.getStatisticsAPI().getUserStatistics();
     
     UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000");
     
     // Get total punishments received
     userStats.getPunishmentCount(uuid).thenAccept(count -> {
         getLogger().info("User has received " + count + " punishments");
     });
     
     // Get ban count
     userStats.getBanCount(uuid).thenAccept(count -> {
         getLogger().info("User has been banned " + count + " times");
     });
 }
 
Seit:
1.2.3
Autor:
Zenith-Studios
  • Konstruktordetails

    • UserStatisticsAPI

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

    • getPunishmentCount

      @NotNull public @NotNull CompletableFuture<Integer> getPunishmentCount(@NotNull @NotNull UUID uuid)
      Gets the total number of punishments a user has received.

      This excludes removal actions (UNBAN, UNMUTE) and only counts actual punishments.

      Example:

      
       UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000");
       userStats.getPunishmentCount(uuid).thenAccept(count -> {
           getLogger().info("User has received " + count + " punishments");
       });
       
      Parameter:
      uuid - The UUID of the user
      Gibt zurück:
      A CompletableFuture that completes with the total number of punishments received
    • getPunishmentCount

      @NotNull public @NotNull CompletableFuture<Integer> getPunishmentCount(@NotNull @NotNull String playerName)
      Gets the total number of punishments a user has received.

      This is an overloaded method that accepts a player name instead of UUID. The player name will be resolved to a UUID first.

      Example:

      
       userStats.getPunishmentCount("PlayerName").thenAccept(count -> {
           getLogger().info("User has received " + count + " punishments");
       });
       
      Parameter:
      playerName - The name of the player
      Gibt zurück:
      A CompletableFuture that completes with the total number of punishments received, or 0 if the player doesn't exist
    • getBanCount

      @NotNull public @NotNull CompletableFuture<Integer> getBanCount(@NotNull @NotNull UUID uuid)
      Gets the number of times a user has been banned.

      Example:

      
       UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000");
       userStats.getBanCount(uuid).thenAccept(count -> {
           getLogger().info("User has been banned " + count + " times");
       });
       
      Parameter:
      uuid - The UUID of the user
      Gibt zurück:
      A CompletableFuture that completes with the number of bans received
    • getBanCount

      @NotNull public @NotNull CompletableFuture<Integer> getBanCount(@NotNull @NotNull String playerName)
      Gets the number of times a user has been banned.

      This is an overloaded method that accepts a player name instead of UUID.

      Example:

      
       userStats.getBanCount("PlayerName").thenAccept(count -> {
           getLogger().info("User has been banned " + count + " times");
       });
       
      Parameter:
      playerName - The name of the player
      Gibt zurück:
      A CompletableFuture that completes with the number of bans received, or 0 if the player doesn't exist
    • getMuteCount

      @NotNull public @NotNull CompletableFuture<Integer> getMuteCount(@NotNull @NotNull UUID uuid)
      Gets the number of times a user has been muted.

      Example:

      
       UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000");
       userStats.getMuteCount(uuid).thenAccept(count -> {
           getLogger().info("User has been muted " + count + " times");
       });
       
      Parameter:
      uuid - The UUID of the user
      Gibt zurück:
      A CompletableFuture that completes with the number of mutes received
    • getMuteCount

      @NotNull public @NotNull CompletableFuture<Integer> getMuteCount(@NotNull @NotNull String playerName)
      Gets the number of times a user has been muted.

      This is an overloaded method that accepts a player name instead of UUID.

      Example:

      
       userStats.getMuteCount("PlayerName").thenAccept(count -> {
           getLogger().info("User has been muted " + count + " times");
       });
       
      Parameter:
      playerName - The name of the player
      Gibt zurück:
      A CompletableFuture that completes with the number of mutes received, or 0 if the player doesn't exist
    • getWarnCount

      @NotNull public @NotNull CompletableFuture<Integer> getWarnCount(@NotNull @NotNull UUID uuid)
      Gets the number of times a user has been warned.

      Example:

      
       UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000");
       userStats.getWarnCount(uuid).thenAccept(count -> {
           getLogger().info("User has been warned " + count + " times");
       });
       
      Parameter:
      uuid - The UUID of the user
      Gibt zurück:
      A CompletableFuture that completes with the number of warns received
    • getWarnCount

      @NotNull public @NotNull CompletableFuture<Integer> getWarnCount(@NotNull @NotNull String playerName)
      Gets the number of times a user has been warned.

      This is an overloaded method that accepts a player name instead of UUID.

      Example:

      
       userStats.getWarnCount("PlayerName").thenAccept(count -> {
           getLogger().info("User has been warned " + count + " times");
       });
       
      Parameter:
      playerName - The name of the player
      Gibt zurück:
      A CompletableFuture that completes with the number of warns received, or 0 if the player doesn't exist
    • getKickCount

      @NotNull public @NotNull CompletableFuture<Integer> getKickCount(@NotNull @NotNull UUID uuid)
      Gets the number of times a user has been kicked.

      Example:

      
       UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000");
       userStats.getKickCount(uuid).thenAccept(count -> {
           getLogger().info("User has been kicked " + count + " times");
       });
       
      Parameter:
      uuid - The UUID of the user
      Gibt zurück:
      A CompletableFuture that completes with the number of kicks received
    • getKickCount

      @NotNull public @NotNull CompletableFuture<Integer> getKickCount(@NotNull @NotNull String playerName)
      Gets the number of times a user has been kicked.

      This is an overloaded method that accepts a player name instead of UUID.

      Example:

      
       userStats.getKickCount("PlayerName").thenAccept(count -> {
           getLogger().info("User has been kicked " + count + " times");
       });
       
      Parameter:
      playerName - The name of the player
      Gibt zurück:
      A CompletableFuture that completes with the number of kicks received, or 0 if the player doesn't exist
    • getNoteCount

      @NotNull public @NotNull CompletableFuture<Integer> getNoteCount(@NotNull @NotNull UUID uuid)
      Gets the number of notes a user has.

      Example:

      
       UUID uuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000");
       userStats.getNoteCount(uuid).thenAccept(count -> {
           getLogger().info("User has " + count + " notes");
       });
       
      Parameter:
      uuid - The UUID of the user
      Gibt zurück:
      A CompletableFuture that completes with the number of notes for the user
    • getNoteCount

      @NotNull public @NotNull CompletableFuture<Integer> getNoteCount(@NotNull @NotNull String playerName)
      Gets the number of notes a user has.

      This is an overloaded method that accepts a player name instead of UUID.

      Example:

      
       userStats.getNoteCount("PlayerName").thenAccept(count -> {
           getLogger().info("User has " + count + " notes");
       });
       
      Parameter:
      playerName - The name of the player
      Gibt zurück:
      A CompletableFuture that completes with the number of notes for the user, or 0 if the player doesn't exist