Class CommandUtils
java.lang.Object
com.gamersafer.minecraft.auth.common.commands.CommandUtils
-
Field Summary
FieldsModifier and TypeFieldDescriptionContains examples of durations accepted byparseDur(ISender, String). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GSAuthApi.LookupResultlookupSender(IPlayerStorage playerStorage, ISender sender) static GSAuthApi.LookupResultlookupUserFromPlayerName(IPlayerStorage playerStorage, ISender sender, String name) Finds the player uuid, last known IP address (alwaysnullifSharedConfiguration.isIpBasedPunishments()is false) and GamerSafer for a given player name.static LongParses 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 (alwaysnullifSharedConfiguration.isIpBasedPunishments()is false) and GamerSafer for a given player name. Also adjusts capitalization of the player name.- Parameters:
playerStorage- thePlayersDBcontaining the relevant data to do the lookupsender- theISenderto send error messages toname- the player name as input for the lookup- Returns:
- a
GSAuthApi.LookupResultwith 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
-