// Path: src/main/java/myessentials/MyEssentialsCore.java
// @Mod(modid = "MyEssentials-Core", name = "MyEssentials-Core", version = "@VERSION@", dependencies = "required-after:Forge", acceptableRemoteVersions = "*")
// public class MyEssentialsCore {
//     @Instance("MyEssentials-Core")
//     public static MyEssentialsCore instance;
// 
//     public Local LOCAL;
//     public Logger LOG;
// 
//     @EventHandler
//     public void preInit(FMLPreInitializationEvent ev) {
// 
//         LOG = ev.getModLog();
//         Constants.CONFIG_FOLDER = ev.getModConfigurationDirectory().getPath() + "/MyEssentials-Core/";
//         Constants.DATABASE_FOLDER = ev.getModConfigurationDirectory().getParent() + "/databases/";
//         // Load Configs
//         Config.instance.init(Constants.CONFIG_FOLDER + "/Core.cfg", "MyEssentials-Core");
//         // REF: The localization can simply take the whole config instance to get the localization needed.
//         LOCAL = new Local(Constants.CONFIG_FOLDER + "/localization/", Config.instance.localization.get(), "/myessentials/localization/", MyEssentialsCore.class);
//         LocalManager.register(LOCAL, "myessentials");
// 
//         // Register handlers/trackers
//         FMLCommonHandler.instance().bus().register(PlayerTracker.instance);
//         MinecraftForge.EVENT_BUS.register(PlayerTracker.instance);
// 
//         FMLCommonHandler.instance().bus().register(ToolManager.instance);
//         MinecraftForge.EVENT_BUS.register(ToolManager.instance);
// 
//         FMLCommonHandler.instance().bus().register(SignManager.instance);
//         MinecraftForge.EVENT_BUS.register(SignManager.instance);
//     }
// }


import myessentials.MyEssentialsCore;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import java.util.HashMap;
import java.util.Map;

package myessentials.utils;


/**
 * Useful methods for Chat
 */
public class ChatUtils {

    private ChatUtils() {

    }

    /**
     * Maps chat formatting by it's code
     */
    private static final Map<Character, EnumChatFormatting> formattingMap = new HashMap<Character, EnumChatFormatting>(22);
    static {
        for(EnumChatFormatting formatting: EnumChatFormatting.values()) {
            formattingMap.put(formatting.getFormattingCode(), formatting);
        }
    }

    public static void sendChat(ICommandSender sender, IChatComponent message) {

        sender.addChatMessage(message);

    }

    public static void sendChat2(ICommandSender sender, String message, Object... args) {

    }

    /**
     * Sends msg to sender.<br />
     * This method will split the message at newline chars (\n) and send each line as a separate message.
     */
    public static void sendChat(ICommandSender sender, String msg, Object... args) {
        if (sender == null) return;
        String[] lines;
        if(args == null) {
            lines = msg.split("\\\\n");
        } else {
            lines = String.format(msg, args).split("\\\\n");
        }
        try {
            for (String line : lines) {
                sender.addChatMessage(chatComponentFromLegacyText(line));
            }
        } catch (Exception ex) {

// Path: src/main/java/myessentials/MyEssentialsCore.java
// @Mod(modid = "MyEssentials-Core", name = "MyEssentials-Core", version = "@VERSION@", dependencies = "required-after:Forge", acceptableRemoteVersions = "*")
// public class MyEssentialsCore {
//     @Instance("MyEssentials-Core")
//     public static MyEssentialsCore instance;
// 
//     public Local LOCAL;
//     public Logger LOG;
// 
//     @EventHandler
//     public void preInit(FMLPreInitializationEvent ev) {
// 
//         LOG = ev.getModLog();
//         Constants.CONFIG_FOLDER = ev.getModConfigurationDirectory().getPath() + "/MyEssentials-Core/";
//         Constants.DATABASE_FOLDER = ev.getModConfigurationDirectory().getParent() + "/databases/";
//         // Load Configs
//         Config.instance.init(Constants.CONFIG_FOLDER + "/Core.cfg", "MyEssentials-Core");
//         // REF: The localization can simply take the whole config instance to get the localization needed.
//         LOCAL = new Local(Constants.CONFIG_FOLDER + "/localization/", Config.instance.localization.get(), "/myessentials/localization/", MyEssentialsCore.class);
//         LocalManager.register(LOCAL, "myessentials");
// 
//         // Register handlers/trackers
//         FMLCommonHandler.instance().bus().register(PlayerTracker.instance);
//         MinecraftForge.EVENT_BUS.register(PlayerTracker.instance);
// 
//         FMLCommonHandler.instance().bus().register(ToolManager.instance);
//         MinecraftForge.EVENT_BUS.register(ToolManager.instance);
// 
//         FMLCommonHandler.instance().bus().register(SignManager.instance);
//         MinecraftForge.EVENT_BUS.register(SignManager.instance);
//     }
// }


// Path: src/main/java/myessentials/utils/ChatUtils.java
import myessentials.MyEssentialsCore;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import java.util.HashMap;
import java.util.Map;

package myessentials.utils;


/**
 * Useful methods for Chat
 */
public class ChatUtils {

    private ChatUtils() {

    }

    /**
     * Maps chat formatting by it's code
     */
    private static final Map<Character, EnumChatFormatting> formattingMap = new HashMap<Character, EnumChatFormatting>(22);
    static {
        for(EnumChatFormatting formatting: EnumChatFormatting.values()) {
            formattingMap.put(formatting.getFormattingCode(), formatting);
        }
    }

    public static void sendChat(ICommandSender sender, IChatComponent message) {

        sender.addChatMessage(message);

    }

    public static void sendChat2(ICommandSender sender, String message, Object... args) {

    }

    /**
     * Sends msg to sender.<br />
     * This method will split the message at newline chars (\n) and send each line as a separate message.
     */
    public static void sendChat(ICommandSender sender, String msg, Object... args) {
        if (sender == null) return;
        String[] lines;
        if(args == null) {
            lines = msg.split("\\\\n");
        } else {
            lines = String.format(msg, args).split("\\\\n");
        }
        try {
            for (String line : lines) {
                sender.addChatMessage(chatComponentFromLegacyText(line));
            }
        } catch (Exception ex) {

            MyEssentialsCore.instance.LOG.error("Failed to send chat message! Message: {}", msg);
