Class GSAuthApi
java.lang.Object
com.gamersafer.minecraft.auth.common.api.GSAuthApi
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
ban
(UUID uuid, UUID banner, @Nullable Date endTime, boolean ipBan, Category category, boolean broadcast, boolean wasChildInvolved, @Nullable String reason) Bans a player.findGuildMemberId
(UUID uuid) Tries to find the guild member ID (GMID) associated with the givenUUID
.Tries to find theUUID
the playername belongs to.static GSAuthApi
get()
getReportLogs
(UUID playerUuid) Fetches all reports created for this user.boolean
hasReports
(UUID uuid) Deprecated.boolean
isAuthenticated
(UUID uuid) Returns whether the user is authenticatedboolean
Returns whether the user is bannedboolean
Returns whether the user is known to the pluginboolean
Returns whether the user is mutedboolean
Returns whether the user is warnedkick
(UUID uuid, UUID kicker, Category category, boolean broadcast, boolean wasChildInvolved, @Nullable String reason) Kicks a player and adds kick record.void
mute
(UUID uuid, UUID muter, @Nullable Date endTime, Category category, boolean broadcast, boolean wasChildInvolved, String reason) Mutes a player.void
Deprecated.Removes all regular bans associated with the given user.Removes all IP-bans associated with the given user.boolean
Unmutes a user.void
warn
(UUID uuid, UUID warner, @Nullable Date endTime, Category category, boolean broadcast, boolean wasChildInvolved, @Nullable String reason) Creates a warning for a player.
-
Constructor Details
-
GSAuthApi
-
-
Method Details
-
get
-
findUuid
Tries to find theUUID
the playername belongs to. If a player is known by that name theOptional
will contain theUUID
for the player. Otherwise, theOptional
will be empty.- Parameters:
playername
- the player to look up theUUID
for- Returns:
- an
CompletableFuture
containing anOptional
with theUUID
of the player if the player is known, otherwise theOptional
will be empty
-
findGuildMemberId
Tries to find the guild member ID (GMID) associated with the givenUUID
. If a player has linked their account to GamerSafer theOptional
will contain the GMID for the player. Otherwise, theOptional
will be empty.- Parameters:
uuid
- the uuid of the player to look up the GMID for- Returns:
- a
CompletableFuture
containing anOptional
with the GMID of the player if the player is known, otherwise theOptional
will be empty.
-
isAuthenticated
Returns whether the user is authenticated- Parameters:
uuid
- theUUID
of the player- Returns:
- whether the user is known
-
isKnown
Returns whether the user is known to the plugin- Parameters:
uuid
- theUUID
of the player- Returns:
- whether the user is known
-
isMuted
Returns whether the user is muted- Parameters:
uuid
- theUUID
of the player- Returns:
- whether the user is muted
-
isBanned
Returns whether the user is banned- Parameters:
uuid
- theUUID
of the player- Returns:
- whether the user is banned
-
isWarned
Returns whether the user is warned- Parameters:
uuid
- theUUID
of the player- Returns:
- whether the user is warned
-
hasReports
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
- theUUID
of the player to banbanner
- theUUID
of player who issued the ban; usenew UUID(0, 0)
for CONSOLEendTime
- when the ban will end.null
for permanent punishmentsipBan
- whether all connections from target's ip will be blockedcategory
- the category of the reasonbroadcast
- whether to broadcast the ban to all playerswasChildInvolved
- whether the reason of the ban involved a childreason
- 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 ofGSAuthApi.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
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. SeeunbanIp(UUID, UUID, String, boolean, String)
- Parameters:
uuid
- theUUID
of the player to unbanunbanner
- theUUID
of player who issued the unban; usenew UUID(0, 0)
for CONSOLEbroadcast
- whether to broadcast the unban to all playersreason
- 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. Seeunban(UUID, UUID, boolean, String)
- Parameters:
uuid
- theUUID
of the player to unbanhostAddress
- the ip address to unbanunbanner
- theUUID
of player who issued the unban; usenew UUID(0, 0)
for CONSOLEbroadcast
- whether to broadcast the unban to all playersreason
- 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
- theUUID
of the player to warnwarner
- theUUID
of player who issued the warning; usenew UUID(0, 0)
for CONSOLEcategory
- the category of the reasonbroadcast
- whether to broadcast the warn to all playerswasChildInvolved
- whether of not the reason of the warn involved a childreason
- 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 ofGSAuthApi.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
- theUUID
of the player to kickkicker
- theUUID
of player who issued the kick; usenew UUID(0, 0)
for CONSOLEcategory
- the category of the reasonbroadcast
- whether to broadcast the kick to all playerswasChildInvolved
- whether of not the reason of the kick involved a childreason
- 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 ofGSAuthApi.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
- theUUID
of the player to mutemuter
- theUUID
of player who issued the mute; usenew UUID(0, 0)
for CONSOLEcategory
- the category of the reasonbroadcast
- whether to broadcast the mute to all playerswasChildInvolved
- whether of not the reason of mute involved a childreason
- 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 ofGSAuthApi.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
Unmutes a user. If theUUID
is associated with a GamerSafer account all linked accounts will also be unmuted.- Parameters:
uuid
- theUUID
of the player to unmuteunmuter
- theUUID
of player who issued the unmute; usenew UUID(0, 0)
for CONSOLEbroadcast
- whether to broadcast the mute to all playersreason
- the reason the player for the unmute; may be null- Returns:
- whether the unmute was successful; false if the user is not muted
-
getReportLogs
Fetches all reports created for this user.- Parameters:
playerUuid
- theUUID
of the player for which the reports should be fetched- Returns:
- a CompletableFuture containing a list with all the reports of the specified user
-