Class CommandUtils
java.lang.Object
com.gamersafer.minecraft.bans.common.commands.CommandUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GSBansApi.NameResultlookupSender(IPlayerStorage playerStorage, ISender sender) static GSBansApi.NameResultlookupUserFromPlayerName(IPlayerStorage playerStorage, ISender sender, String name) Finds the player uuid and GamerSafer for a given player name.static LongParses a duration input of the format 1d1h, 1d, or 1h.
-
Constructor Details
-
CommandUtils
public CommandUtils()
-
-
Method Details
-
lookupUserFromPlayerName
public static GSBansApi.NameResult lookupUserFromPlayerName(IPlayerStorage playerStorage, ISender sender, String name) Finds the player uuid 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 NameResult with the resolved data, NameResult.isSuccess() 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
-