Using annotation key translation

This commit is contained in:
方块君
2022-05-08 14:44:14 +08:00
committed by Melledy
parent ef3579da82
commit 3a5503de72
40 changed files with 53 additions and 227 deletions

View File

@@ -13,7 +13,7 @@ import java.util.List;
import static emu.grasscutter.utils.Language.translate;
@SuppressWarnings("ConstantConditions")
@Command(label = "sendmail", usage = "sendmail <userId|all|help> [templateId]", permission = "server.sendmail")
@Command(label = "sendmail", usage = "sendmail <userId|all|help> [templateId]", permission = "server.sendmail", description = "commands.sendMail.description")
public final class SendMailCommand implements CommandHandler {
// TODO: You should be able to do /sendmail and then just send subsequent messages until you finish
@@ -23,11 +23,6 @@ public final class SendMailCommand implements CommandHandler {
// Key = User that is constructing the mail.
private static final HashMap<Integer, MailBuilder> mailBeingConstructed = new HashMap<Integer, MailBuilder>();
@Override
public String description() {
return translate("commands.sendMail.description");
}
// Yes this is awful and I hate it.
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
@@ -44,7 +39,7 @@ public final class SendMailCommand implements CommandHandler {
MailBuilder mailBuilder;
switch (args.get(0).toLowerCase()) {
case "help" -> {
CommandHandler.sendMessage(sender, this.description() + "\nUsage: " + this.getClass().getAnnotation(Command.class).usage());
CommandHandler.sendMessage(sender, translate(this.getClass().getAnnotation(Command.class).description()) + "\nUsage: " + this.getClass().getAnnotation(Command.class).usage());
return;
}
case "all" -> mailBuilder = new MailBuilder(true, new Mail());