Blockbuster

Blockbuster

809k Downloads

I18n in SubCommandBase

LatvianModder opened this issue ยท 4 comments

commented

@Override
public String getCommandUsage(ICommandSender sender)
{
String message = I18n.format(this.getHelp()) + "\n\n";
for (CommandBase command : this.subcommands.values())
{
message += I18n.format(command.getCommandUsage(sender)).split("\n")[0] + "\n";
}
return message.trim();
}

This is completely wrong. getCommandUsage() returns an unlocalized string like "commands.name.usage", not translated one. Also caused this crash, because you are using client-side-only class on server side:
https://github.com/LatvianModder/FTBUtilities/issues/846

Why do you have your own class at all? CommandTreeBase exists

commented

Hm, interesting... This code was there for 2 years in the mod, and the crash was only found now ๐Ÿ˜‚

Thanks for reporting! It was written long time ago so I didn't really knew how to do things back then. I also needed a short version of the command, i.e. without the full description of sub-commands. I'll see what I'll be able to do about it.

CommandTreeBase exists

I'll take a look at it, but you know If it ainโ€™t broke, donโ€™t fix it. ๐Ÿ˜„

commented

https://github.com/LatvianModder/FTBQuests/tree/master/src/main/java/com/feed_the_beast/ftbquests/command
You can take a look here for example (CommandFTBQuests being the main one here). And you can have CommandTreeBase children too, thus, tree command

commented

Ah, I see, I'll try it out when I'll have chance. Thanks!

commented

Fixed by simply returning the language string of the command. I don't really want to deal with CommandTreeBase. Thanks for reporting! ๐Ÿ™‚