2121import cn .nukkit .command .CommandSender ;
2222import de .kcodeyt .plotplugin .PlotPlugin ;
2323import de .kcodeyt .plotplugin .command .defaults .*;
24+ import de .kcodeyt .plotplugin .lang .TranslationKey ;
2425
2526import java .util .Arrays ;
2627import java .util .LinkedHashSet ;
@@ -36,27 +37,27 @@ public PlotCommand(PlotPlugin plugin) {
3637 this .plugin = plugin ;
3738 this .subCommands = new LinkedHashSet <>();
3839
39- this .subCommands .add (new AddHelperCommand (this .plugin ));
40- this .subCommands .add (new AutoCommand (this .plugin ));
41- this .subCommands .add (new ClaimCommand (this .plugin ));
42- this .subCommands .add (new ClearCommand (this .plugin ));
43- this .subCommands .add (new DenyCommand (this .plugin ));
44- this .subCommands .add (new DisposeCommand (this .plugin ));
45- this .subCommands .add (new GenerateCommand (this .plugin ));
46- this .subCommands .add (new HomeCommand (this .plugin ));
47- this .subCommands .add (new InfoCommand (this .plugin ));
48- this .subCommands .add (new MergeCommand (this .plugin ));
49- this .subCommands .add (new RegenAllRoadsCommand (this .plugin ));
50- this .subCommands .add (new RegenRoadCommand (this .plugin ));
51- this .subCommands .add (new ReloadCommand (this .plugin ));
52- this .subCommands .add (new RemoveHelperCommand (this .plugin ));
53- this .subCommands .add (new SetOwnerCommand (this .plugin ));
54- this .subCommands .add (new SetRoadsCommand (this .plugin ));
55- this .subCommands .add (new SettingCommand (this .plugin ));
56- this .subCommands .add (new TeleportCommand (this .plugin ));
57- this .subCommands .add (new UndenyCommand (this .plugin ));
58- this .subCommands .add (new UnlinkCommand (this .plugin ));
59- this .subCommands .add (new WarpCommand (this .plugin ));
40+ this .subCommands .add (new AddHelperCommand (this .plugin , this ));
41+ this .subCommands .add (new AutoCommand (this .plugin , this ));
42+ this .subCommands .add (new ClaimCommand (this .plugin , this ));
43+ this .subCommands .add (new ClearCommand (this .plugin , this ));
44+ this .subCommands .add (new DenyCommand (this .plugin , this ));
45+ this .subCommands .add (new DisposeCommand (this .plugin , this ));
46+ this .subCommands .add (new GenerateCommand (this .plugin , this ));
47+ this .subCommands .add (new HomeCommand (this .plugin , this ));
48+ this .subCommands .add (new InfoCommand (this .plugin , this ));
49+ this .subCommands .add (new MergeCommand (this .plugin , this ));
50+ this .subCommands .add (new RegenAllRoadsCommand (this .plugin , this ));
51+ this .subCommands .add (new RegenRoadCommand (this .plugin , this ));
52+ this .subCommands .add (new ReloadCommand (this .plugin , this ));
53+ this .subCommands .add (new RemoveHelperCommand (this .plugin , this ));
54+ this .subCommands .add (new SetOwnerCommand (this .plugin , this ));
55+ this .subCommands .add (new SetRoadsCommand (this .plugin , this ));
56+ this .subCommands .add (new SettingCommand (this .plugin , this ));
57+ this .subCommands .add (new TeleportCommand (this .plugin , this ));
58+ this .subCommands .add (new UndenyCommand (this .plugin , this ));
59+ this .subCommands .add (new UnlinkCommand (this .plugin , this ));
60+ this .subCommands .add (new WarpCommand (this .plugin , this ));
6061 }
6162
6263 @ Override
@@ -75,15 +76,20 @@ public boolean execute(CommandSender sender, String label, String[] args) {
7576 return subCommand .execute (player , args );
7677 }
7778
78- player .sendMessage (this .translate ("help-title" ));
79+ player .sendMessage (this .translate (player , TranslationKey . HELP_TITLE ));
7980 for (SubCommand subCommand : this .subCommands )
80- if (subCommand .hasPermission (player )) player .sendMessage (this .translate ("help-" + subCommand .getName ()));
81- player .sendMessage (this .translate ("help-end" ));
81+ if (subCommand .hasPermission (player ))
82+ player .sendMessage (this .translate (player , subCommand .getHelpTranslationKey ()));
83+ player .sendMessage (this .translate (player , TranslationKey .HELP_END ));
8284 return true ;
8385 }
8486
85- private String translate (String message ) {
86- return this .plugin .getLanguage ().translate (message );
87+ protected String translate (Player player , TranslationKey key ) {
88+ return this .plugin .getLanguage ().translate (player , key );
89+ }
90+
91+ protected String translate (Player player , TranslationKey key , Object ... params ) {
92+ return this .plugin .getLanguage ().translate (player , key , params );
8793 }
8894
8995}
0 commit comments