package net.new_liberty.commandtimer;

import net.new_liberty.commandtimer.timer.TimerManager;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
import java.util.logging.Level;
import net.new_liberty.commandtimer.set.CommandSetManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

/**
 * Command Timer.
 */
public class CommandTimer extends JavaPlugin {
    private static CommandTimer instance;

    private static final Map<String, String> DEFAULT_MESSAGES;

    static {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String>builder();

        builder.put("warmup", "&6Command will run in &c%time% seconds. Don't move.");
        builder.put("warmup-cancelled", "&cPending command request cancelled.");
        builder.put("warmup-in-progress", "&cThis command is warming up. Don't move.");
        builder.put("warmup-no-interact", "&cError: &6You can't do this while the command is warming up!");
        builder.put("cooldown", "&cError: &6You must wait &c%time% seconds to use this command again.");

        DEFAULT_MESSAGES = builder.build();
    }
    /**
     * Manages our command sets
     */
    private CommandSetManager commandSets;

    /**
     * Manages our timers (warmups and cooldowns)
     */
    private TimerManager timers;

    /**
     * Stores the global messages.
     */
    private Map<String, String> messages;

    @Override
    public void onEnable() {
        instance = this;

        saveDefaultConfig();
        reloadConfig();
        loadConfig();

        Bukkit.getPluginManager().registerEvents(new CTListener(this), this);

        timers = new TimerManager(this);
        timers.startTasks();
    }

    /**
     * Loads the configuration.
     */
    private void loadConfig() {
        Map[] c = ConfigLoader.loadConfig(getConfig());
        messages = c[0];
        commandSets = new CommandSetManager(c[1], c[2], c[3]);
        commandSets.setupPermissions();
    }

    /**
     * Gets the CommandSetManager instance.
     *
     * @return
     */
    public CommandSetManager getCommandSets() {
        return commandSets;
    }

    /**
     * Gets the TimerManager instance.
     *
     * @return
     */
    public TimerManager getTimers() {
        return timers;
    }

    /**
     * Gets a CTPlayer.
     *
     * @param name
     * @return
     */
    public CTPlayer getPlayer(String name) {
        return new CTPlayer(this, name);
    }

    /**
     * Gets the default message.
     *
     * @param key
     * @return
     */
    public String getMessage(String key) {
        String msg = messages.get(key);
        if (msg == null) {
            msg = DEFAULT_MESSAGES.get(key);
        }
        return msg;
    }

    /**
     * Gets this CommandTimer instance.
     *
     * @return
     */
    public static CommandTimer getInstance() {
        return instance;
    }

    /**
     * Logs a message.
     *
     * @param level
     * @param msg
     */
    public static void log(Level level, String msg) {
        instance.getLogger().log(level, msg);
    }
}

@@ -274,16 +274,45 @@
 Bukkit;%0A
+import org.bukkit.ChatColor;%0A
 import o
@@ -2764,20 +2764,65 @@
   return
+ ChatColor.translateAlternateColorCodes('&',
  msg
+)
 ;%0A    %7D%0A

Replace color codes in messages