mirror of
https://github.com/aikar/commands.git
synced 2026-05-31 06:11:55 +00:00
fix the format API's and add setFormat(type, i, color)
This commit is contained in:
@@ -58,17 +58,26 @@ public class BungeeCommandManager extends CommandManager {
|
||||
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) {
|
||||
MessageFormatter format = getFormat(type);
|
||||
if (format instanceof BungeeMessageFormatter) {
|
||||
for (int i = 0; i < colors.length; i++) {
|
||||
((BungeeMessageFormatter) format).setColor(i, colors[i]);
|
||||
}
|
||||
} else {
|
||||
setFormat(type, new BungeeMessageFormatter(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) {
|
||||
|
||||
Reference in New Issue
Block a user