Class CommandUtils
java.lang.Object
com.gamersafer.minecraft.bans.common.commands.CommandUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic GSBansApi.NameResult
lookupSender
(IPlayerStorage playerStorage, ISender sender) static GSBansApi.NameResult
lookupUserFromPlayerName
(IPlayerStorage playerStorage, ISender sender, String name) Finds the player uuid and GamerSafer for a given player name.static Long
Parses 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
- 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 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
-