Remove deprecated Velocity 1.0.0 Command API.
This commit is contained in:
@@ -32,66 +32,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
* to Velocity.
|
||||
*
|
||||
* </ul>
|
||||
*
|
||||
* <p>For this reason, the legacy {@code execute}, {@code suggest} and
|
||||
* {@code 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 {@link CommandManager} if and only if
|
||||
* the given command <b>directly</b> implements this interface.
|
||||
*/
|
||||
public interface Command {
|
||||
|
||||
/**
|
||||
* Executes the command for the specified source.
|
||||
*
|
||||
* @param source the source to execute the command for
|
||||
* @param args the arguments for the command
|
||||
* @deprecated see {@link Command}
|
||||
*/
|
||||
@Deprecated
|
||||
default void execute(final CommandSource source, final String @NonNull [] args) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides tab complete suggestions for the specified source.
|
||||
*
|
||||
* @param source the source to execute the command for
|
||||
* @param currentArgs the partial arguments for the command
|
||||
* @return the tab complete suggestions
|
||||
* @deprecated see {@link Command}
|
||||
*/
|
||||
@Deprecated
|
||||
default List<String> suggest(final CommandSource source, final String @NonNull [] currentArgs) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides tab complete suggestions for the specified source.
|
||||
*
|
||||
* @param source the source to execute the command for
|
||||
* @param currentArgs the partial arguments for the command
|
||||
* @return the tab complete suggestions
|
||||
* @deprecated see {@link Command}
|
||||
*/
|
||||
@Deprecated
|
||||
default CompletableFuture<List<String>> suggestAsync(final CommandSource source,
|
||||
String @NonNull [] currentArgs) {
|
||||
return CompletableFuture.completedFuture(suggest(source, currentArgs));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests to check if the source has permission to perform the command with
|
||||
* the provided arguments.
|
||||
*
|
||||
* @param source the source to execute the command for
|
||||
* @param args the arguments for the command
|
||||
* @return {@code true} if the source has permission
|
||||
* @deprecated see {@link Command}
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean hasPermission(final CommandSource source, final String @NonNull [] args) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -33,19 +33,6 @@ public interface CommandManager {
|
||||
*/
|
||||
CommandMeta.Builder metaBuilder(BrigadierCommand command);
|
||||
|
||||
/**
|
||||
* Registers the specified command with the specified aliases.
|
||||
*
|
||||
* @param command the command to register
|
||||
* @param aliases the command aliases
|
||||
*
|
||||
* @throws IllegalArgumentException if one of the given aliases is already registered
|
||||
* @deprecated This method requires at least one alias, but this is only enforced at runtime.
|
||||
* Prefer {@link #register(String, Command, String...)}
|
||||
*/
|
||||
@Deprecated
|
||||
void register(Command command, String... aliases);
|
||||
|
||||
/**
|
||||
* Registers the specified command with the specified aliases.
|
||||
*
|
||||
@@ -54,7 +41,9 @@ public interface CommandManager {
|
||||
* @param otherAliases additional aliases
|
||||
* @throws IllegalArgumentException if one of the given aliases is already registered
|
||||
*/
|
||||
void register(String alias, Command command, String... otherAliases);
|
||||
default void register(String alias, Command command, String... otherAliases) {
|
||||
register(metaBuilder(alias).aliases(otherAliases).build(), command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the specified Brigadier command.
|
||||
|
@@ -7,10 +7,6 @@
|
||||
|
||||
package com.velocitypowered.api.command;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* A specialized sub-interface of {@code Command} which indicates the proxy should pass
|
||||
* the command and its arguments directly without further processing.
|
||||
@@ -18,77 +14,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
*/
|
||||
public interface RawCommand extends InvocableCommand<RawCommand.Invocation> {
|
||||
|
||||
/**
|
||||
* Executes the command for the specified source.
|
||||
*
|
||||
* @param source the source to execute the command for
|
||||
* @param cmdLine the arguments for the command
|
||||
* @deprecated see {@link Command}
|
||||
*/
|
||||
@Deprecated
|
||||
default void execute(final CommandSource source, final String cmdLine) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
default void execute(final CommandSource source, final String @NonNull [] args) {
|
||||
execute(source, String.join(" ", args));
|
||||
}
|
||||
|
||||
@Override
|
||||
default void execute(Invocation invocation) {
|
||||
// Guarantees ABI compatibility
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides tab complete suggestions for the specified source.
|
||||
*
|
||||
* @param source the source to execute the command for
|
||||
* @param currentArgs the partial arguments for the command
|
||||
* @return the tab complete suggestions
|
||||
* @deprecated see {@link Command}
|
||||
*/
|
||||
@Deprecated
|
||||
default CompletableFuture<List<String>> suggest(final CommandSource source,
|
||||
final String currentArgs) {
|
||||
// This method even has an inconsistent return type
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
default List<String> suggest(final CommandSource source, final String @NonNull [] currentArgs) {
|
||||
return suggestAsync(source, currentArgs).join();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
default CompletableFuture<List<String>> suggestAsync(final CommandSource source,
|
||||
final String @NonNull [] currentArgs) {
|
||||
return suggest(source, String.join(" ", currentArgs));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests to check if the source has permission to perform the command with
|
||||
* the provided arguments.
|
||||
*
|
||||
* @param source the source to execute the command for
|
||||
* @param cmdLine the arguments for the command
|
||||
* @return {@code true} if the source has permission
|
||||
* @deprecated see {@link Command}
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean hasPermission(final CommandSource source, final String cmdLine) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
default boolean hasPermission(final CommandSource source, final String @NonNull [] args) {
|
||||
return hasPermission(source, String.join(" ", args));
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains the invocation data for a raw command.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user