Package com.ldtteam.structurize.commands
Class AbstractCommand
java.lang.Object
com.ldtteam.structurize.commands.AbstractCommand
- Direct Known Subclasses:
EntryPoint,PasteCommand,PasteFolderCommand,ScanCommand,UpdateSchematicPackCommand,UpdateSchematicsCommand,UpgradeCommand.ToDO
Interface for all commands
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classClass for building command trees efectivelystatic classOur dummy exception type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack> build()Builds command's tree.protected static net.minecraft.commands.Commands.CommandSelectionGet's command's server environment type.protected static <T> com.mojang.brigadier.builder.RequiredArgumentBuilder<net.minecraft.commands.CommandSourceStack, T> newArgument(String name, com.mojang.brigadier.arguments.ArgumentType<T> type) Creates new command argument, used for collection selector, number picker etc.protected static com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack> newLiteral(String name) Creates new subcommand, used for subcommands and type picking.static voidThrows command syntax exception.static voidthrowSyntaxException(String key, Object... format) Throws command syntax exception.
-
Constructor Details
-
AbstractCommand
public AbstractCommand()
-
-
Method Details
-
getEnvironmentType
protected static net.minecraft.commands.Commands.CommandSelection getEnvironmentType()Get's command's server environment type.- Returns:
- in which command environment should be command registered
-
build
protected static com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack> build()Builds command's tree.- Returns:
- new built command
-
newLiteral
protected static com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack> newLiteral(String name) Creates new subcommand, used for subcommands and type picking.- Parameters:
name- subcommand name- Returns:
- new node builder
-
newArgument
protected static <T> com.mojang.brigadier.builder.RequiredArgumentBuilder<net.minecraft.commands.CommandSourceStack,T> newArgument(String name, com.mojang.brigadier.arguments.ArgumentType<T> type) Creates new command argument, used for collection selector, number picker etc.- Type Parameters:
T- argument class type- Parameters:
name- argument name, aka description/alias, but it's also id key to get argument value from command during executiontype- argument type, see net.minecraft.command.arguments- Returns:
- new node builder
-
throwSyntaxException
public static void throwSyntaxException(String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException Throws command syntax exception.- Parameters:
key- language key to translate- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
throwSyntaxException
public static void throwSyntaxException(String key, Object... format) throws com.mojang.brigadier.exceptions.CommandSyntaxException Throws command syntax exception.- Parameters:
key- language key to translateformat- String.format() attributes- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-