Class GSAuthApi

java.lang.Object
com.gamersafer.minecraft.auth.common.api.GSAuthApi

public class GSAuthApi extends Object
  • Constructor Details

  • Method Details

    • get

      public static GSAuthApi get()
    • findUuid

      public CompletableFuture<Optional<UUID>> findUuid(String playername)
      Tries to find the UUID the playername belongs to. If a player is known by that name the Optional will contain the UUID for the player. Otherwise, the Optional will be empty.
      Parameters:
      playername - the player to look up the UUID for
      Returns:
      an CompletableFuture containing an Optional with the UUID of the player if the player is known, otherwise the Optional will be empty
    • findGuildMemberId

      public CompletableFuture<Optional<String>> findGuildMemberId(UUID uuid)
      Tries to find the guild member ID (GMID) associated with the given UUID. If a player has linked their account to GamerSafer the Optional will contain the GMID for the player. Otherwise, the Optional will be empty.
      Parameters:
      uuid - the uuid of the player to look up the GMID for
      Returns:
      a CompletableFuture containing an Optional with the GMID of the player if the player is known, otherwise the Optional will be empty.
    • isAuthenticated

      public boolean isAuthenticated(UUID uuid)
      Returns whether the user is authenticated
      Parameters:
      uuid - the UUID of the player
      Returns:
      whether the user is known
    • isKnown

      public boolean isKnown(UUID uuid)
      Returns whether the user is known to the plugin
      Parameters:
      uuid - the UUID of the player
      Returns:
      whether the user is known
    • isMuted

      public boolean isMuted(UUID uuid)
      Returns whether the user is muted
      Parameters:
      uuid - the UUID of the player
      Returns:
      whether the user is muted
    • isBanned

      public boolean isBanned(UUID uuid)
      Returns whether the user is banned
      Parameters:
      uuid - the UUID of the player
      Returns:
      whether the user is banned
    • isWarned

      public boolean isWarned(UUID uuid)
      Returns whether the user is warned
      Parameters:
      uuid - the UUID of the player
      Returns:
      whether the user is warned
    • hasReports

      @Deprecated public boolean hasReports(UUID uuid)
      Deprecated.
      Removed
    • ban

      public boolean ban(UUID uuid, UUID banner, @Nullable Date endTime, boolean ipBan, Category category, boolean broadcast, boolean wasChildInvolved, @Nullable String reason)
      Bans a player. If uuid is linked to GamerSafer account all linked accounts will be banned.
      Parameters:
      uuid - the UUID of the player to ban
      banner - the UUID of player who issued the ban; use new UUID(0, 0) for CONSOLE
      endTime - when the ban will end. null for permanent punishments
      ipBan - whether all connections from target's ip will be blocked
      category - the category of the reason
      broadcast - whether to broadcast the ban to all players
      wasChildInvolved - whether the reason of the ban involved a child
      reason - the reason the player should be banned for; may be null
      Returns:
      whether the ban was successful; false if the user is already banned
      Throws:
      IllegalArgumentException - when uuid is null, banner is null, category does not match any of GSAuthApi.CATEGORIES, the player is not known, the banner is not known, or does not have a GamerSafer account (checks for the banner do not apply for CONSOLE (UUID(0, 0)))
    • unban

      public UnbanResult unban(UUID uuid, UUID unbanner, boolean broadcast, @Nullable String reason)
      Removes all regular bans associated with the given user. If uuid is linked to GamerSafer account all linked accounts will be unbanned. NOTE: IP-bans are not removed. See unbanIp(UUID, UUID, String, boolean, String)
      Parameters:
      uuid - the UUID of the player to unban
      unbanner - the UUID of player who issued the unban; use new UUID(0, 0) for CONSOLE
      broadcast - whether to broadcast the unban to all players
      reason - the reason the player for the unban; may be null
      Returns:
      whether the unban was successful; false if the user is not banned
    • unbanIp

      public UnbanResult unbanIp(UUID uuid, UUID unbanner, String hostAddress, boolean broadcast, @Nullable String reason)
      Removes all IP-bans associated with the given user. If uuid is linked to GamerSafer account all linked accounts will be unbanned. NOTE: non IP-bans are not removed. See unban(UUID, UUID, boolean, String)
      Parameters:
      uuid - the UUID of the player to unban
      hostAddress - the ip address to unban
      unbanner - the UUID of player who issued the unban; use new UUID(0, 0) for CONSOLE
      broadcast - whether to broadcast the unban to all players
      reason - the reason the player for the unban; may be null
      Returns:
      whether the unban was successful; false if the user is not banned
    • report

      @Deprecated public void report(UUID uuid, UUID reporter, String category, boolean wasChildInvolved, String reason)
      Deprecated.
      Removed
    • warn

      public void warn(UUID uuid, UUID warner, @Nullable Date endTime, Category category, boolean broadcast, boolean wasChildInvolved, @Nullable String reason)
      Creates a warning for a player.
      Parameters:
      uuid - the UUID of the player to warn
      warner - the UUID of player who issued the warning; use new UUID(0, 0) for CONSOLE
      category - the category of the reason
      broadcast - whether to broadcast the warn to all players
      wasChildInvolved - whether of not the reason of the warn involved a child
      reason - the reason the player should be warned for; may be null
      Throws:
      IllegalArgumentException - when uuid is null, warner is null, category does not match any of GSAuthApi.CATEGORIES, the player is not known, the warner is not known, or does not have a GamerSafer account (checks for the warner do not apply for CONSOLE (UUID(0, 0)))
    • kick

      public CompletableFuture<Boolean> kick(UUID uuid, UUID kicker, Category category, boolean broadcast, boolean wasChildInvolved, @Nullable String reason)
      Kicks a player and adds kick record.
      Parameters:
      uuid - the UUID of the player to kick
      kicker - the UUID of player who issued the kick; use new UUID(0, 0) for CONSOLE
      category - the category of the reason
      broadcast - whether to broadcast the kick to all players
      wasChildInvolved - whether of not the reason of the kick involved a child
      reason - the reason the player should be kicked for; may be null
      Returns:
      whether the kick was successful; false if the user is not online
      Throws:
      IllegalArgumentException - when uuid is null, banner is null, category does not match any of GSAuthApi.CATEGORIES, the player is not known, the kicker is not known, or does not have a GamerSafer account (checks for the banner do not apply for CONSOLE (UUID(0, 0)))
    • mute

      public void mute(UUID uuid, UUID muter, @Nullable Date endTime, Category category, boolean broadcast, boolean wasChildInvolved, String reason)
      Mutes a player. If uuid is linked to GamerSafer account all linked accounts will be muted.
      Parameters:
      uuid - the UUID of the player to mute
      muter - the UUID of player who issued the mute; use new UUID(0, 0) for CONSOLE
      category - the category of the reason
      broadcast - whether to broadcast the mute to all players
      wasChildInvolved - whether of not the reason of mute involved a child
      reason - the reason the player should be muted for; may be null
      Throws:
      IllegalArgumentException - when uuid is null, muter is null, category does not match any of GSAuthApi.CATEGORIES, the player is not known, the muter is not known, or does not have a GamerSafer account (checks for the banner do not apply for CONSOLE (UUID(0, 0)))
    • unmute

      public boolean unmute(UUID uuid, UUID unmuter, boolean broadcast, @Nullable String reason)
      Unmutes a user. If the UUID is associated with a GamerSafer account all linked accounts will also be unmuted.
      Parameters:
      uuid - the UUID of the player to unmute
      unmuter - the UUID of player who issued the unmute; use new UUID(0, 0) for CONSOLE
      broadcast - whether to broadcast the mute to all players
      reason - the reason the player for the unmute; may be null
      Returns:
      whether the unmute was successful; false if the user is not muted
    • getReportLogs

      public CompletableFuture<List<ReportLog>> getReportLogs(UUID playerUuid)
      Fetches all reports created for this user.
      Parameters:
      playerUuid - the UUID of the player for which the reports should be fetched
      Returns:
      a CompletableFuture containing a list with all the reports of the specified user