Introduce a new arguments parser (#1629)

Original commits:

* Clean-up

* Introduce a new application arguments parser & handler

* Clean-up and deprecate `Tools#getLanguageOption`

* Fix `-debug` and `-debugall` parameters

* found this while debugging, ...why

* Remove deprecated parameters

* Invoke startup argument parser before handbook generation

* Move command map instantiation to `Grasscutter `(prevent making 3 instances on startup)

* Ensure \n at EOF

Co-authored-by: AnimeGitB <AnimeGitB@bigblueball.in>
This commit is contained in:
Magix
2022-08-09 22:24:43 -04:00
committed by GitHub
parent e20b185dc0
commit 3121e3e67d
11 changed files with 134 additions and 75 deletions

View File

@@ -4,6 +4,7 @@ import emu.grasscutter.Grasscutter;
import emu.grasscutter.auth.AuthenticationSystem;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.command.CommandMap;
import emu.grasscutter.command.PermissionHandler;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.server.game.GameServer;
@@ -72,7 +73,7 @@ public final class ServerHook {
if(!clazz.isAnnotationPresent(Command.class))
throw new IllegalArgumentException("Command handler must be annotated with @Command.");
Command commandData = clazz.getAnnotation(Command.class);
this.gameServer.getCommandMap().registerCommand(commandData.label(), handler);
CommandMap.getInstance().registerCommand(commandData.label(), handler);
}
/**