Class GSBansApi
java.lang.Object
com.gamersafer.minecraft.bans.common.api.GSBansApi
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionContains all available categories for mutes, reports, bans, and kicks. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionban
(UUID uuid, UUID banner, @Nullable Date endTime, String category, boolean wasChildInvolved, String reason) Bans a player.Tries to find theUUID
the playername belongs to.getReportLogs
(UUID playerUuid) Fetches all reports created for this user.Returns whether the user is bannedReturns whether the user is authenticatedReturns whether the user is mutedReturns whether the user is warnedKicks a player and adds are kick record.mute
(UUID uuid, UUID muter, @Nullable Date endTime, String category, boolean wasChildInvolved, String reason) Mutes a player.Unbans a user.Unbans a user.Unmutes a user.warn
(UUID uuid, UUID warner, @Nullable Date endTime, String category, boolean wasChildInvolved, String reason) Creates a warning for a player.
-
Field Details
-
CATEGORIES
Contains all available categories for mutes, reports, bans, and kicks.
-
-
Constructor Details
-
GSBansApi
-
-
Method Details
-
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
-
isKnown
Returns whether the user is authenticated- Parameters:
uuid
- theUUID
of the player- Returns:
- whether the user is authenticated
-
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
-
ban
public CompletableFuture<Boolean> ban(UUID uuid, UUID banner, @Nullable Date endTime, String category, boolean wasChildInvolved, 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 CONSOLEcategory
- the category of the reason; for possible value seeGSBansApi.CATEGORIES
wasChildInvolved
- whether the reason of the ban involved a childreason
- the reason the player should be banned for; may not 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 ofGSBansApi.CATEGORIES
, reason is null, 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
Unbans a user. If uuid is linked to GamerSafer account all linked accounts will be unbanned.- Parameters:
uuid
- theUUID
of the player to unbanunbanner
- theUUID
of player who issued the unban; usenew UUID(0, 0)
for CONSOLE- Returns:
- whether the unban was successful; false if the user is not banned
-
unban
Unbans a user. If uuid is linked to GamerSafer account all linked accounts will be unbanned.- Parameters:
uuid
- theUUID
of the player to unbanunbanner
- theUUID
of player who issued the unban; usenew UUID(0, 0)
for CONSOLEreason
- the reason the player for the unban; may not be null- Returns:
- whether the unban was successful; false if the user is not banned
-
warn
public CompletableFuture<Void> warn(UUID uuid, UUID warner, @Nullable Date endTime, String category, boolean wasChildInvolved, 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 reason; for possible value seeGSBansApi.CATEGORIES
wasChildInvolved
- whether of not the reason of the warn involved a childreason
- the reason the player should be warned for; may not be null- Throws:
IllegalArgumentException
- when uuid is null, warner is null, category does not match any ofGSBansApi.CATEGORIES
, reason is null, 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, String category, boolean wasChildInvolved, String reason) Kicks a player and adds are 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 reason; for possible value seeGSBansApi.CATEGORIES
wasChildInvolved
- whether of not the reason of the kick involved a childreason
- the reason the player should be kicked for; may not 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 ofGSBansApi.CATEGORIES
, reason is null, 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 CompletableFuture<Void> mute(UUID uuid, UUID muter, @Nullable Date endTime, String category, 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 reason; for possible value seeGSBansApi.CATEGORIES
wasChildInvolved
- whether of not the reason of mute involved a childreason
- the reason the player should be muted for; may not be null- Throws:
IllegalArgumentException
- when uuid is null, muter is null, category does not match any ofGSBansApi.CATEGORIES
, reason is null, 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 CONSOLE- 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
-