Move MessageFormatter stuff to base class using generics, readd default formatter G/S

This commit is contained in:
Aikar
2017-07-18 21:52:42 -04:00
parent 418bbd6fd9
commit ef3b844ffa
6 changed files with 34 additions and 66 deletions
@@ -38,7 +38,7 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
public class BungeeCommandManager extends CommandManager<CommandSender, BungeeMessageFormatter> {
public class BungeeCommandManager extends CommandManager<CommandSender, ChatColor, BungeeMessageFormatter> {
protected final Plugin plugin;
protected Map<String, BungeeRootCommand> registeredCommands = new HashMap<>();
@@ -58,26 +58,6 @@ public class BungeeCommandManager extends CommandManager<CommandSender, BungeeMe
return this.plugin;
}
public BungeeMessageFormatter setFormat(MessageType type, BungeeMessageFormatter formatter) {
return (BungeeMessageFormatter) formatters.put(type, formatter);
}
public BungeeMessageFormatter getFormat(MessageType type) {
return (BungeeMessageFormatter) formatters.getOrDefault(type, defaultFormatter);
}
public void setFormat(MessageType type, ChatColor... colors) {
BungeeMessageFormatter format = getFormat(type);
for (int i = 0; i < colors.length; i++) {
format.setColor(i, colors[i]);
}
}
public void setFormat(MessageType type, int i, ChatColor color) {
BungeeMessageFormatter format = getFormat(type);
format.setColor(i, color);
}
@Override
public synchronized CommandContexts<BungeeCommandExecutionContext> getCommandContexts() {
if (this.contexts == null) {