LiteralArgument not works
tanyaofei opened this issue · comments
CommandAPI version
9.0.3
Minecraft version
1.20.1
Are you shading the CommandAPI?
Yes
What I did
new CommandAPICommand("mapdel")
.withAliases("networkmap:mapdel")
.withOptionalArguments("confirm")
.executesPlayer((sender, args) -> {
boolean confirm = args.get("confirm") != null;
})
.register();
What actually happened
Can not get the confirm
argument
What should have happened
Get the argument.
Server logs and CommandAPI config
No response
Other
Here is what I did on loading my plugin:
@Override
public void onLoad() {
instance = this;
CommandAPI.onLoad(new CommandAPIBukkitConfig(this).silentLogs(true));
}
@Override
public void onEnable() {
CommandRegistry.register(); // register all my commands
CommandAPI.onEnable();
}
Well, I found the reason in Document
.
Developer's Note:
There is a simpler alternative to the LiteralArgument class! Instead of having to deal with arguments not being present in the array of arguments, consider using the much more intuitive MultiLiteralArgument, which is described in more detail here!