3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Rename CommandManager#metaBuilder -> CommandManager#createMetaBuilder

Dieser Commit ist enthalten in:
Andrew Steinborn 2021-04-17 04:23:58 -04:00
Ursprung cf7c2b004a
Commit 2254e3b617
5 geänderte Dateien mit 15 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -13,19 +13,16 @@ import com.velocitypowered.api.proxy.connection.Player;
* Represents a command that can be executed by a {@link CommandSource} * Represents a command that can be executed by a {@link CommandSource}
* such as a {@link Player} or the console. * such as a {@link Player} or the console.
* *
* <p>Velocity 1.1.0 introduces specialized command subinterfaces to separate * <p><strong>You should not subclass <code>Command</code></strong>. Use one of the following
* command parsing concerns. These include, in order of preference: * subinterfaces:</p>
* *
* <ul> * <ul>
* <li>{@link BrigadierCommand}, which supports parameterized arguments and * <li>{@link BrigadierCommand} wraps a Brigadier literal command node. It supports parameterized
* specialized execution, tab complete suggestions and permission-checking logic. * arguments and specialized execution, tab complete suggestions and permission-checking logic.
* *
* <li>{@link SimpleCommand}, modelled after the convention popularized by * <li>{@link SimpleCommand} is modelled after the convention popularized by Bukkit and BungeeCord.
* Bukkit and BungeeCord. Older classes directly implementing {@link Command}
* are suggested to migrate to this interface.
* *
* <li>{@link RawCommand}, useful for bolting on external command frameworks * <li>{@link RawCommand} is useful for bolting on external command frameworks onto Velocity.
* to Velocity.
* *
* </ul> * </ul>
*/ */

Datei anzeigen

@ -8,7 +8,7 @@
package com.velocitypowered.api.command; package com.velocitypowered.api.command;
/** /**
* Provides information related to the possible execution of a {@link Command}. * Provides information related to the (possible) execution of a {@link Command}.
* *
* @param <T> the type of the arguments * @param <T> the type of the arguments
*/ */

Datei anzeigen

@ -22,7 +22,7 @@ public interface CommandManager {
* @param alias the first command alias * @param alias the first command alias
* @return a {@link CommandMeta} builder * @return a {@link CommandMeta} builder
*/ */
CommandMeta.Builder metaBuilder(String alias); CommandMeta.Builder createMetaBuilder(String alias);
/** /**
* Returns a builder to create a {@link CommandMeta} for * Returns a builder to create a {@link CommandMeta} for
@ -31,7 +31,7 @@ public interface CommandManager {
* @param command the command * @param command the command
* @return a {@link CommandMeta} builder * @return a {@link CommandMeta} builder
*/ */
CommandMeta.Builder metaBuilder(BrigadierCommand command); CommandMeta.Builder createMetaBuilder(BrigadierCommand command);
/** /**
* Registers the specified command with the specified aliases. * Registers the specified command with the specified aliases.
@ -42,7 +42,7 @@ public interface CommandManager {
* @throws IllegalArgumentException if one of the given aliases is already registered * @throws IllegalArgumentException if one of the given aliases is already registered
*/ */
default void register(String alias, Command command, String... otherAliases) { default void register(String alias, Command command, String... otherAliases) {
register(metaBuilder(alias).aliases(otherAliases).build(), command); register(createMetaBuilder(alias).aliases(otherAliases).build(), command);
} }
/** /**

Datei anzeigen

@ -56,13 +56,13 @@ public class VelocityCommandManager implements CommandManager {
} }
@Override @Override
public CommandMeta.Builder metaBuilder(final String alias) { public CommandMeta.Builder createMetaBuilder(final String alias) {
Preconditions.checkNotNull(alias, "alias"); Preconditions.checkNotNull(alias, "alias");
return new VelocityCommandMeta.Builder(alias); return new VelocityCommandMeta.Builder(alias);
} }
@Override @Override
public CommandMeta.Builder metaBuilder(final BrigadierCommand command) { public CommandMeta.Builder createMetaBuilder(final BrigadierCommand command) {
Preconditions.checkNotNull(command, "command"); Preconditions.checkNotNull(command, "command");
return new VelocityCommandMeta.Builder(command.getNode().getName()); return new VelocityCommandMeta.Builder(command.getNode().getName());
} }
@ -70,7 +70,7 @@ public class VelocityCommandManager implements CommandManager {
@Override @Override
public void register(final BrigadierCommand command) { public void register(final BrigadierCommand command) {
Preconditions.checkNotNull(command, "command"); Preconditions.checkNotNull(command, "command");
register(metaBuilder(command).build(), command); register(createMetaBuilder(command).build(), command);
} }
@Override @Override

Datei anzeigen

@ -44,7 +44,6 @@ import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class CommandManagerTests { public class CommandManagerTests {
@ -91,7 +90,7 @@ public class CommandManagerTests {
.<CommandSource>literal("bar") .<CommandSource>literal("bar")
.build(); .build();
BrigadierCommand aliasesCommand = new BrigadierCommand(barNode); BrigadierCommand aliasesCommand = new BrigadierCommand(barNode);
CommandMeta meta = manager.metaBuilder(aliasesCommand) CommandMeta meta = manager.createMetaBuilder(aliasesCommand)
.aliases("baZ") .aliases("baZ")
.build(); .build();
@ -412,7 +411,7 @@ public class CommandManagerTests {
CommandNode<CommandSource> bazHint = LiteralArgumentBuilder CommandNode<CommandSource> bazHint = LiteralArgumentBuilder
.<CommandSource>literal("baz") .<CommandSource>literal("baz")
.build(); .build();
CommandMeta meta = manager.metaBuilder("foo") CommandMeta meta = manager.createMetaBuilder("foo")
.aliases("foo2") .aliases("foo2")
.hint(barHint) .hint(barHint)
.hint(bazHint) .hint(bazHint)