Use per-platform Locales classes

This commit is contained in:
Aikar
2017-07-17 21:07:53 -04:00
parent 1c4e2d83d6
commit 89d5e86823
7 changed files with 85 additions and 14 deletions
@@ -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());
}
}