🐛 Fix command registration for Velocity
We need to recreate the Brigadier command node each time a command is extended, and the code was only letting each command get registered once.
This commit is contained in:
parent
0d44a8c944
commit
7036beb8ad
4 changed files with 12 additions and 16 deletions
|
|
@ -78,16 +78,21 @@ public class CloudVelocityTest {
|
|||
annotationParser.parse(this);
|
||||
}
|
||||
|
||||
@CommandMethod(value = "test", permission = "cloud.root")
|
||||
private void testRoot(@Nonnull final CommandSource source) {
|
||||
source.sendMessage(TextComponent.builder("Hello from the root!", NamedTextColor.GOLD));
|
||||
}
|
||||
|
||||
@CommandMethod("test <num> [str]")
|
||||
private void testCommand(@Nonnull @Argument(value = "str", defaultValue = "potato") final String string,
|
||||
@Nonnull final CommandSource source,
|
||||
@Argument("num") @Range(min = "10", max = "33") final int num) {
|
||||
source.sendMessage(TextComponent.builder()
|
||||
.append("You wrote: ", NamedTextColor.GOLD)
|
||||
.append(string, NamedTextColor.RED)
|
||||
.append(" and ", NamedTextColor.GOLD)
|
||||
.append(Integer.toString(num), NamedTextColor.RED)
|
||||
.append("!", NamedTextColor.GOLD)
|
||||
.append("You wrote: ", NamedTextColor.GOLD)
|
||||
.append(string, NamedTextColor.RED)
|
||||
.append(" and ", NamedTextColor.GOLD)
|
||||
.append(Integer.toString(num), NamedTextColor.RED)
|
||||
.append("!", NamedTextColor.GOLD)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue