Class CommandUtils
java.lang.Object
com.gamersafer.minecraft.auth.common.commands.CommandUtils
-
Field Summary
Modifier and TypeFieldDescriptionContains examples of durations accepted byparseDur(ISender, String)
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic GSAuthApi.LookupResult
lookupSender
(IPlayerStorage playerStorage, ISender sender) static GSAuthApi.LookupResult
lookupUserFromPlayerName
(IPlayerStorage playerStorage, ISender sender, String name) Finds the player uuid, last known IP address (alwaysnull
ifSharedConfiguration.isIpBasedPunishments()
is false) and GamerSafer for a given player name.static Long
Parses a duration input of the format 1d1h, 1d, or 1h.
-
Field Details
-
DURATION_EXAMPLES
Contains examples of durations accepted byparseDur(ISender, String)
.
-
-
Constructor Details
-
CommandUtils
public CommandUtils()
-
-
Method Details
-
lookupUserFromPlayerName
public static GSAuthApi.LookupResult lookupUserFromPlayerName(IPlayerStorage playerStorage, ISender sender, String name) Finds the player uuid, last known IP address (alwaysnull
ifSharedConfiguration.isIpBasedPunishments()
is false) and GamerSafer for a given player name. Also adjusts capitalization of the player name.- Parameters:
playerStorage
- thePlayersDB
containing the relevant data to do the lookupsender
- theISender
to send error messages toname
- the player name as input for the lookup- Returns:
- a
GSAuthApi.LookupResult
with the resolved data,GSAuthApi.LookupResult.success()
will be true if all lookup succeeded, otherwise false
-
lookupSender
-
parseDur
Parses a duration input of the format 1d1h, 1d, or 1h.- Parameters:
sender
- the sender to send error messages tos
- the input string- Returns:
- the parsed duration in milliseconds or null if parsing failed
-