mirror of
https://github.com/aikar/commands.git
synced 2026-06-07 17:22:17 +00:00
Use per-platform Locales classes
This commit is contained in:
@@ -44,11 +44,10 @@ public class BungeeCommandManager extends CommandManager {
|
||||
protected Map<String, BungeeRootCommand> registeredCommands = new HashMap<>();
|
||||
protected BungeeCommandContexts contexts;
|
||||
protected BungeeCommandCompletions completions;
|
||||
protected BungeeLocales locales;
|
||||
|
||||
public BungeeCommandManager(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
String pluginName = "acf-" + plugin.getDescription().getName();
|
||||
this.locales.addMessageBundles("acf-minecraft", pluginName, pluginName.toLowerCase());
|
||||
this.formatters.put(MessageType.ERROR, new BungeeMessageFormatter(ChatColor.RED, ChatColor.YELLOW, ChatColor.RED));
|
||||
this.formatters.put(MessageType.SYNTAX, new BungeeMessageFormatter(ChatColor.YELLOW, ChatColor.GREEN, ChatColor.WHITE));
|
||||
this.formatters.put(MessageType.INFO, new BungeeMessageFormatter(ChatColor.BLUE, ChatColor.DARK_GREEN, ChatColor.GREEN));
|
||||
@@ -74,6 +73,15 @@ public class BungeeCommandManager extends CommandManager {
|
||||
return completions;
|
||||
}
|
||||
|
||||
@Override
|
||||
BungeeLocales getLocales() {
|
||||
if (this.locales == null) {
|
||||
this.locales = new BungeeLocales(this);
|
||||
}
|
||||
return locales;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerCommand(BaseCommand command) {
|
||||
command.onRegister(this);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package co.aikar.commands;
|
||||
|
||||
public class BungeeLocales extends Locales {
|
||||
BungeeLocales(BungeeCommandManager manager) {
|
||||
super(manager);
|
||||
String pluginName = "acf-" + manager.plugin.getDescription().getName();
|
||||
addMessageBundles("acf-minecraft", pluginName, pluginName.toLowerCase());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user