Interface Command

  • All Known Subinterfaces:
    InvocableCommand<I>, RawCommand, SimpleCommand
    All Known Implementing Classes:
    BrigadierCommand

    public interface Command
    Represents a command that can be executed by a CommandSource such as a Player or the console.

    Velocity 1.1.0 introduces specialized command subinterfaces to separate command parsing concerns. These include, in order of preference:

    • BrigadierCommand, which supports parameterized arguments and specialized execution, tab complete suggestions and permission-checking logic.
    • SimpleCommand, modelled after the convention popularized by Bukkit and BungeeCord. Older classes directly implementing Command are suggested to migrate to this interface.
    • RawCommand, useful for bolting on external command frameworks to Velocity.

    For this reason, the legacy execute, suggest and hasPermission methods are deprecated and will be removed in Velocity 2.0.0. We suggest implementing one of the more specific subinterfaces instead. The legacy methods are executed by a CommandManager if and only if the given command directly implements this interface.

    • Method Detail

      • execute

        @Deprecated
        default void execute​(CommandSource source,
                             String @NonNull [] args)
        Deprecated.
        Executes the command for the specified source.
        Parameters:
        source - the source to execute the command for
        args - the arguments for the command
      • suggest

        @Deprecated
        default List<String> suggest​(CommandSource source,
                                     String @NonNull [] currentArgs)
        Deprecated.
        Provides tab complete suggestions for the specified source.
        Parameters:
        source - the source to execute the command for
        currentArgs - the partial arguments for the command
        Returns:
        the tab complete suggestions
      • suggestAsync

        @Deprecated
        default CompletableFuture<List<String>> suggestAsync​(CommandSource source,
                                                             String @NonNull [] currentArgs)
        Deprecated.
        Provides tab complete suggestions for the specified source.
        Parameters:
        source - the source to execute the command for
        currentArgs - the partial arguments for the command
        Returns:
        the tab complete suggestions
      • hasPermission

        @Deprecated
        default boolean hasPermission​(CommandSource source,
                                      String @NonNull [] args)
        Deprecated.
        Tests to check if the source has permission to perform the command with the provided arguments.
        Parameters:
        source - the source to execute the command for
        args - the arguments for the command
        Returns:
        true if the source has permission