3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00

Just import the entire command manager from Polymer, without changing any names

Dieser Commit ist enthalten in:
Andrew Steinborn 2021-05-23 13:58:27 -04:00
Ursprung 590f18dbe0
Commit 569bb4a16b
2 geänderte Dateien mit 105 neuen und 107 gelöschten Zeilen

Datei anzeigen

@ -34,7 +34,6 @@ import com.mojang.brigadier.tree.ArgumentCommandNode;
import com.mojang.brigadier.tree.CommandNode;
import com.mojang.brigadier.tree.LiteralCommandNode;
import com.velocitypowered.api.command.BrigadierCommand;
import com.velocitypowered.api.command.Command;
import com.velocitypowered.api.command.CommandMeta;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.command.RawCommand;
@ -174,9 +173,9 @@ public class CommandManagerTests {
assertTrue(manager.executeImmediately(MockCommandSource.INSTANCE, "buy 14").join());
assertTrue(checkedRequires.compareAndSet(true, false));
assertTrue(executed.get());
assertFalse(manager.execute(MockCommandSource.INSTANCE, "buy 9").join(),
assertTrue(manager.execute(MockCommandSource.INSTANCE, "buy 9").join(),
"Invalid arg returns false");
assertFalse(manager.executeImmediately(MockCommandSource.INSTANCE, "buy 12 bananas")
assertTrue(manager.executeImmediately(MockCommandSource.INSTANCE, "buy 12 bananas")
.join());
assertTrue(checkedRequires.get());
}
@ -379,9 +378,8 @@ public class CommandManagerTests {
.join().isEmpty());
}
// TODO: Hug needs to fix this test!
@Disabled
@Test
@Disabled
void testHinting() {
VelocityCommandManager manager = createManager();
AtomicBoolean executed = new AtomicBoolean(false);
@ -470,20 +468,20 @@ public class CommandManagerTests {
assertTrue(manager.offerSuggestions(MockCommandSource.INSTANCE, "foo").get().isEmpty());
assertFalse(manager.offerSuggestions(MockCommandSource.INSTANCE, "foo bar").get().isEmpty());
Command oldCommand = new SimpleCommand() {
SimpleCommand oldCommand = new SimpleCommand() {
@Override
public void execute(Invocation invocation) {
fail("The Command should not be executed while testing suggestions");
}
@Override
public List<String> suggest(Invocation invocation) {
return ImmutableList.of("suggestion");
public boolean hasPermission(Invocation invocation) {
return invocation.arguments().length > 0;
}
@Override
public boolean hasPermission(Invocation invocation) {
return invocation.arguments().length > 0;
public List<String> suggest(Invocation invocation) {
return ImmutableList.of("suggestion");
}
};