Class AbstractCommand

java.lang.Object
com.ldtteam.structurize.commands.AbstractCommand
Direct Known Subclasses:
EntryPoint, PasteCommand, PasteFolderCommand, ScanCommand, UpdateSchematicsCommand, UpgradeCommand.ToDO

public abstract class AbstractCommand extends Object
Interface for all commands
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
    Class for building command trees efectively
    static class 
    Our dummy exception type
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack>
    Builds command's tree.
    protected static net.minecraft.commands.Commands.CommandSelection
    Get'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>
    Creates new subcommand, used for subcommands and type picking.
    static void
    Throws command syntax exception.
    static void
    Throws command syntax exception.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 execution
      type - 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 translate
      format - String.format() attributes
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException