Package org.moddingx.libx.command
Class CommandUtil
java.lang.Object
org.moddingx.libx.command.CommandUtil
Utilities for commands.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
getArgumentOrDefault
(com.mojang.brigadier.context.CommandContext<?> ctx, String name, Class<T> clazz, T defaultValue) Gets an argument for a command and if it's not present a default value.
-
Constructor Details
-
CommandUtil
public CommandUtil()
-
-
Method Details
-
getArgumentOrDefault
public static <T> T getArgumentOrDefault(com.mojang.brigadier.context.CommandContext<?> ctx, String name, Class<T> clazz, T defaultValue) Gets an argument for a command and if it's not present a default value.- Parameters:
name
- The argument's nameclazz
- The argument's classdefaultValue
- A default value when the argument is not present.
-