// Path: src/main/java/com/endercrest/voidspawn/utils/MessageUtil.java
// public class MessageUtil {
// 
//     /**
//      * Add Color to Messages
//      *
//      * @param str The String
//      * @return Coloured String
//      */
//     public static String colorize(String str){
//         return str.replaceAll("(?i)&([a-f0-9k-or])", "\u00a7$1");
//     }
// 
//     public static String colorize(String str, Object... args){
//         return colorize(String.format(str, args));
//     }
// }


import com.endercrest.voidspawn.commands.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import com.endercrest.voidspawn.utils.MessageUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

    /**
     * Load the commands into the HashMap that makes it accessible to players.
     */
    private void loadCommands(){
        commands.put("set", new SetCommand());
        commands.put("remove", new RemoveCommand());
        commands.put("reload", new ReloadCommand());
        commands.put("modes", new ModesCommand());
        commands.put("mode", new ModeCommand());
        commands.put("help", new HelpCommand(commands));
        commands.put("toggle", new ToggleCommand());
        commands.put("detector", new DetectorCommand());
        commands.put("info", new InfoCommand());
        commands.put("option", new OptionCommand());
    }

    public Set<Map.Entry<String, SubCommand>> getCommands() {
        return commands.entrySet();
    }

    public SubCommand getSubCommand(String cmd) {
        return commands.get(cmd);
    }

    @Override
    public boolean onCommand(@NotNull CommandSender cs, @NotNull Command cmd, @NotNull String s, String[] args){
        if(!(cs instanceof Player)){
            if((args.length >= 1) && (args[0].equalsIgnoreCase("reload"))){
                ConfigManager.getInstance().reloadConfig();
// Path: src/main/java/com/endercrest/voidspawn/utils/MessageUtil.java
// public class MessageUtil {
// 
//     /**
//      * Add Color to Messages
//      *
//      * @param str The String
//      * @return Coloured String
//      */
//     public static String colorize(String str){
//         return str.replaceAll("(?i)&([a-f0-9k-or])", "\u00a7$1");
//     }
// 
//     public static String colorize(String str, Object... args){
//         return colorize(String.format(str, args));
//     }
// }


// Path: src/main/java/com/endercrest/voidspawn/CommandHandler.java
import com.endercrest.voidspawn.commands.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import com.endercrest.voidspawn.utils.MessageUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;


    /**
     * Load the commands into the HashMap that makes it accessible to players.
     */
    private void loadCommands(){
        commands.put("set", new SetCommand());
        commands.put("remove", new RemoveCommand());
        commands.put("reload", new ReloadCommand());
        commands.put("modes", new ModesCommand());
        commands.put("mode", new ModeCommand());
        commands.put("help", new HelpCommand(commands));
        commands.put("toggle", new ToggleCommand());
        commands.put("detector", new DetectorCommand());
        commands.put("info", new InfoCommand());
        commands.put("option", new OptionCommand());
    }

    public Set<Map.Entry<String, SubCommand>> getCommands() {
        return commands.entrySet();
    }

    public SubCommand getSubCommand(String cmd) {
        return commands.get(cmd);
    }

    @Override
    public boolean onCommand(@NotNull CommandSender cs, @NotNull Command cmd, @NotNull String s, String[] args){
        if(!(cs instanceof Player)){
            if((args.length >= 1) && (args[0].equalsIgnoreCase("reload"))){
                ConfigManager.getInstance().reloadConfig();
                cs.sendMessage(MessageUtil.colorize(VoidSpawn.prefix + "&6Plugin Reloaded"));