[3.0.1] Brigadier Tab Complete 1.12.2
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 959
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 2
Description
I'm using Brigadier commands in my plugin, and when I connect with a 1.12.2 client, the tab complete defaults to the first option in the list overwriting what the user has typed. When I used the same plugin with a modern client (1.17.1) the tab complete works. I am unsure if this something I am doing, is as intended, or is a bug, but I wanted to put it here just in case. (Velocity 3.0.1) Please tell me if you need any more information :-)
An example:
Code
VelocityTest.java
@Plugin(id = "test",
name = "Test",
version = "1.0",
description = "Brigadier Test",
authors = { "Me" }
)
public class VelocityTest {
private final ProxyServer server;
private final Logger logger;
private final TestCommand testCommand;
@Inject
public VelocityTest(ProxyServer server, Logger logger) {
this.server = server;
this.logger = logger;
this.testCommand = new TestCommand();
logger.info("Brigadier Test has been loaded");
}
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
CommandManager commandManager = server.getCommandManager();
commandManager.register(testCommand.getCommand());
logger.info("Test Command registered");
}
}
TestCommand.java
public class TestCommand {
private final BrigadierCommand command;
public TestCommand() {
LiteralCommandNode<CommandSource> node = LiteralArgumentBuilder
.<CommandSource>literal("test")
.executes(context -> {
CommandSource source = context.getSource();
if (source instanceof Player player) {
player.sendMessage(Component.text("/test [arguments]").color(NamedTextColor.GRAY));
}
return 1;
}
).build();
ArgumentCommandNode<CommandSource, String> argumentNode = RequiredArgumentBuilder
.<CommandSource, String>argument("arguments", StringArgumentType.word())
.suggests((context, builder) -> {
builder.suggest("foo");
builder.suggest("bar");
builder.suggest("velocity");
builder.suggest("minecraft");
builder.suggest("proxy");
builder.suggest("tengo-hambre");
return builder.buildFuture();
})
.executes(context -> {
CommandSource source = context.getSource();
//If Source is a Player
if (source instanceof Player player) {
player.sendMessage(Component.text(context.getInput()));
}
return 1;
}
).build();
node.addChild(argumentNode);
this.command = new BrigadierCommand(node);
}
public BrigadierCommand getCommand() {
return command;
}
}
build.gradle
plugins {
id 'java-library'
}
group = 'me'
version = '1.0'
repositories {
maven {
name 'velocity'
url 'https://nexus.velocitypowered.com/repository/maven-public/'
}
}
dependencies {
compileOnly "com.velocitypowered:velocity-api:3.0.1"
annotationProcessor "com.velocitypowered:velocity-api:3.0.1"
}
https://user-images.githubusercontent.com/1719877/142702142-f18e392e-f3e5-496a-a7c8-fdc400768fa8.mp4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior using the supplied VelocityTest.java and TestCommand.java example with Velocity API 3.0.1, comparing a 1.12.2 client with a 1.17.1 client. Determine whether the older client’s tab completion overwrites input through Velocity, and use that comparison to establish the expected behavior and scope of a fix or regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100