Class CommandHelper
java.lang.Object
net.darkhax.bookshelf.common.api.util.CommandHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Enum<T> & IEnumCommand>
voidbuildFromEnum(com.mojang.brigadier.builder.ArgumentBuilder<net.minecraft.commands.CommandSourceStack, ?> parent, Class<T> enumClass) Creates branching command paths that represent the values of an enum.static <T extends Enum<T> & IEnumCommand>
com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack> buildFromEnum(String parent, Class<T> enumClass) Creates a command with branching paths that represent the values of an enum.static <T extends Enum<T> & IEnumCommand>
PermissionLevelgetLowestLevel(Class<T> enumClass) Gets the lowest required permission level for an enum command.static <T> booleanhasArgument(String argument, com.mojang.brigadier.context.CommandContext<T> context)
-
Constructor Details
-
CommandHelper
public CommandHelper()
-
-
Method Details
-
buildFromEnum
public static <T extends Enum<T> & IEnumCommand> com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack> buildFromEnum(String parent, Class<T> enumClass) Creates a command with branching paths that represent the values of an enum.- Type Parameters:
T- The type of the enum.- Parameters:
parent- The name of the root parent command node.enumClass- The enum class to use.- Returns:
- The newly created command node.
-
buildFromEnum
public static <T extends Enum<T> & IEnumCommand> void buildFromEnum(com.mojang.brigadier.builder.ArgumentBuilder<net.minecraft.commands.CommandSourceStack, ?> parent, Class<T> enumClass) Creates branching command paths that represent the values of an enum.- Type Parameters:
T- The type of the enum.- Parameters:
parent- The parent node to branch off from.enumClass- The enum class to use.
-
getLowestLevel
Gets the lowest required permission level for an enum command.- Type Parameters:
T- The type of the enum.- Parameters:
enumClass- The enum class to use.- Returns:
- The lowest required permission level for an enum command.
-
hasArgument
public static <T> boolean hasArgument(String argument, com.mojang.brigadier.context.CommandContext<T> context)
-