Class BrigadierCommand

java.lang.Object
com.velocitypowered.api.command.BrigadierCommand
All Implemented Interfaces:
Command

public final class BrigadierCommand extends Object implements Command
A command that uses Brigadier for parsing the command and providing suggestions to the client.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The return code used by a Command to indicate the command execution should be forwarded to the backend server.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BrigadierCommand(@NotNull com.mojang.brigadier.builder.LiteralArgumentBuilder<CommandSource> builder)
    Constructs a BrigadierCommand from the node returned by the given builder.
    BrigadierCommand(@NotNull com.mojang.brigadier.tree.LiteralCommandNode<CommandSource> node)
    Constructs a BrigadierCommand from the given command node.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.mojang.brigadier.tree.LiteralCommandNode<CommandSource>
    Returns the literal node for this command.
    static com.mojang.brigadier.builder.LiteralArgumentBuilder<CommandSource>
    Creates a new LiteralArgumentBuilder of the required name.
    static <T> com.mojang.brigadier.builder.RequiredArgumentBuilder<CommandSource,T>
    requiredArgumentBuilder(@NotNull String name, @NotNull com.mojang.brigadier.arguments.ArgumentType<T> argumentType)
    Creates a new RequiredArgumentBuilder of the required name and type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • FORWARD

      public static final int FORWARD
      The return code used by a Command to indicate the command execution should be forwarded to the backend server.
      See Also:
  • Constructor Details

    • BrigadierCommand

      public BrigadierCommand(@NotNull @NotNull com.mojang.brigadier.builder.LiteralArgumentBuilder<CommandSource> builder)
      Constructs a BrigadierCommand from the node returned by the given builder.
      Parameters:
      builder - the LiteralCommandNode builder
    • BrigadierCommand

      public BrigadierCommand(@NotNull @NotNull com.mojang.brigadier.tree.LiteralCommandNode<CommandSource> node)
      Constructs a BrigadierCommand from the given command node.
      Parameters:
      node - the command node
  • Method Details

    • getNode

      public com.mojang.brigadier.tree.LiteralCommandNode<CommandSource> getNode()
      Returns the literal node for this command.
      Returns:
      the command node
    • literalArgumentBuilder

      public static com.mojang.brigadier.builder.LiteralArgumentBuilder<CommandSource> literalArgumentBuilder(@NotNull @NotNull String name)
      Creates a new LiteralArgumentBuilder of the required name.
      Parameters:
      name - the literal name.
      Returns:
      a new LiteralArgumentBuilder.
    • requiredArgumentBuilder

      public static <T> com.mojang.brigadier.builder.RequiredArgumentBuilder<CommandSource,T> requiredArgumentBuilder(@NotNull @NotNull String name, @NotNull @NotNull com.mojang.brigadier.arguments.ArgumentType<T> argumentType)
      Creates a new RequiredArgumentBuilder of the required name and type.
      Type Parameters:
      T - the ArgumentType required type
      Parameters:
      name - the argument name
      argumentType - the argument type required
      Returns:
      a new RequiredArgumentBuilder