3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-09-29 06:30:16 +02: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}
* such as a {@link Player} or the console.
*
* <p>Velocity 1.1.0 introduces specialized command subinterfaces to separate
* command parsing concerns. These include, in order of preference:
* <p><strong>You should not subclass <code>Command</code></strong>. Use one of the following
* subinterfaces:</p>
*
* <ul>
* <li>{@link BrigadierCommand}, which supports parameterized arguments and
* specialized execution, tab complete suggestions and permission-checking logic.
* <li>{@link BrigadierCommand} wraps a Brigadier literal command node. It supports parameterized
* arguments and specialized execution, tab complete suggestions and permission-checking logic.
*
* <li>{@link SimpleCommand}, modelled after the convention popularized by
* Bukkit and BungeeCord. Older classes directly implementing {@link Command}
* are suggested to migrate to this interface.
* <li>{@link SimpleCommand} is modelled after the convention popularized by Bukkit and BungeeCord.
*
* <li>{@link RawCommand}, useful for bolting on external command frameworks
* to Velocity.
* <li>{@link RawCommand} is useful for bolting on external command frameworks onto Velocity.
*
* </ul>
*/

Datei anzeigen

@ -8,7 +8,7 @@
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
*/

Datei anzeigen

@ -22,7 +22,7 @@ public interface CommandManager {
* @param alias the first command alias
* @return a {@link CommandMeta} builder
*/
CommandMeta.Builder metaBuilder(String alias);
CommandMeta.Builder createMetaBuilder(String alias);
/**
* Returns a builder to create a {@link CommandMeta} for
@ -31,7 +31,7 @@ public interface CommandManager {
* @param command the command
* @return a {@link CommandMeta} builder
*/
CommandMeta.Builder metaBuilder(BrigadierCommand command);
CommandMeta.Builder createMetaBuilder(BrigadierCommand command);
/**
* 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
*/
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
public CommandMeta.Builder metaBuilder(final String alias) {
public CommandMeta.Builder createMetaBuilder(final String alias) {
Preconditions.checkNotNull(alias, "alias");
return new VelocityCommandMeta.Builder(alias);
}
@Override
public CommandMeta.Builder metaBuilder(final BrigadierCommand command) {
public CommandMeta.Builder createMetaBuilder(final BrigadierCommand command) {
Preconditions.checkNotNull(command, "command");
return new VelocityCommandMeta.Builder(command.getNode().getName());
}
@ -70,7 +70,7 @@ public class VelocityCommandManager implements CommandManager {
@Override
public void register(final BrigadierCommand command) {
Preconditions.checkNotNull(command, "command");
register(metaBuilder(command).build(), command);
register(createMetaBuilder(command).build(), command);
}
@Override

Datei anzeigen

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