package me.exz.omniocular.network;

import me.exz.omniocular.handler.ConfigHandler;
import net.minecraft.entity.player.EntityPlayerMP;

public class NetworkHelper {

    private static void sendString(String string, EntityPlayerMP player) {
        ConfigMessageHandler.network.sendTo(new ConfigMessage(string), player);
    }

    public static void sendConfigString(String string, EntityPlayerMP player) {
        sendString("__START__", player);
        int size = 10240;
        while (string.length() > size) {
            sendString(string.substring(0, size), player);
            string = string.substring(size);
        }
        sendString(string, player);
        sendString("__END__", player);
    }

    public static void recvConfigString(String string) {
        if (string.equals("__START__")) {
            ConfigHandler.mergedConfig = "";
        } else if (string.equals("__END__")) {
            ConfigHandler.parseConfigFiles();
        } else {
            ConfigHandler.mergedConfig += string;
        }
    }
}

@@ -888,32 +888,110 @@
 s(%22__END__%22)) %7B%0A
+//            LogHelper.info(%22received config: %22+ConfigHandler.mergedConfig);%0A
             Conf

debug usage