// Path: src/main/java/net/nickac/lithium/frontend/mod/network/packethandler/abstracts/MessageImpl.java
// public class MessageImpl implements Message {
// 
//     private String key;
//     private List<String> data;
// 
//     public MessageImpl(String key, List<String> data) {
//         this.key = key;
//         this.data = data;
//     }
// 
//     @Override
//     public String getKey() {
//         return key;
//     }
// 
//     @Override
//     public List<String> getData() {
//         return data;
//     }
// }
// 
// Path: src/main/java/net/nickac/lithium/frontend/mod/network/packethandler/abstracts/PacketHandler.java
// public interface PacketHandler {
//     @SideOnly(Side.CLIENT)
//     void handlePacket(Message message);
// }


import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.nickac.lithium.frontend.mod.network.packethandler.abstracts.MessageImpl;
import net.nickac.lithium.frontend.mod.network.packethandler.abstracts.PacketHandler;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
package net.nickac.lithium.frontend.mod.network;



public class Handle implements IMessageHandler<LithiumMessage, IMessage> {

    private static PacketHandler packetHandler;

    public static void setPacketHandler(PacketHandler packetHandler) {
        Handle.packetHandler = packetHandler;
    }


    @SideOnly(Side.CLIENT)
    @Override
    public IMessage onMessage(LithiumMessage message, MessageContext ctx) {
        String receivedMessage = message.getText().trim();
        String[] msgArray = receivedMessage.split("\\|");
        String key = msgArray[0];

        List<String> data = new ArrayList<>();

        if(msgArray.length>1){
            List<String> par = Arrays.asList(msgArray).subList(1, msgArray.length);
            System.out.println(par);
            data.addAll(par);
        }
// Path: src/main/java/net/nickac/lithium/frontend/mod/network/packethandler/abstracts/MessageImpl.java
// public class MessageImpl implements Message {
// 
//     private String key;
//     private List<String> data;
// 
//     public MessageImpl(String key, List<String> data) {
//         this.key = key;
//         this.data = data;
//     }
// 
//     @Override
//     public String getKey() {
//         return key;
//     }
// 
//     @Override
//     public List<String> getData() {
//         return data;
//     }
// }
// 
// Path: src/main/java/net/nickac/lithium/frontend/mod/network/packethandler/abstracts/PacketHandler.java
// public interface PacketHandler {
//     @SideOnly(Side.CLIENT)
//     void handlePacket(Message message);
// }


// Path: src/main/java/net/nickac/lithium/frontend/mod/network/Handle.java
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.nickac.lithium.frontend.mod.network.packethandler.abstracts.MessageImpl;
import net.nickac.lithium.frontend.mod.network.packethandler.abstracts.PacketHandler;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

package net.nickac.lithium.frontend.mod.network;



public class Handle implements IMessageHandler<LithiumMessage, IMessage> {

    private static PacketHandler packetHandler;

    public static void setPacketHandler(PacketHandler packetHandler) {
        Handle.packetHandler = packetHandler;
    }


    @SideOnly(Side.CLIENT)
    @Override
    public IMessage onMessage(LithiumMessage message, MessageContext ctx) {
        String receivedMessage = message.getText().trim();
        String[] msgArray = receivedMessage.split("\\|");
        String key = msgArray[0];

        List<String> data = new ArrayList<>();

        if(msgArray.length>1){
            List<String> par = Arrays.asList(msgArray).subList(1, msgArray.length);
            System.out.println(par);
            data.addAll(par);
        }
        packetHandler.handlePacket(new MessageImpl(key, data));