// Path: src/protocolsupportpocketstuff/api/util/PocketPacketListener.java
// public interface PocketPacketListener { }
// 
// Path: src/protocolsupportpocketstuff/util/packet/serializer/PacketSerializer.java
// public class PacketSerializer {
// 
// 	public static int readPacketId(ByteBuf from) {
// 		int id = VarNumberSerializer.readVarInt(from);
// 		return id;
// 	}
// 
// }


import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import io.netty.buffer.ByteBuf;
import protocolsupport.api.Connection;
import protocolsupport.api.Connection.PacketListener;
import protocolsupport.api.ProtocolType;
import protocolsupport.api.utils.Any;
import protocolsupport.protocol.ConnectionImpl;
import protocolsupportpocketstuff.api.util.PocketPacketHandler;
import protocolsupportpocketstuff.api.util.PocketPacketListener;
import protocolsupportpocketstuff.util.packet.serializer.PacketSerializer;
			Set<Handler> handlers = any.getObj2();
			handlers.add(handler);
		}
	}

	public static class Handler {

		private PocketPacketListener listener;
		private Method method;

		public Handler(PocketPacketListener listener, Method method) {
			this.listener = listener;
			this.method = method;
		}

		public void handle(Connection connection, PEPacket packet) {
			try {
				method.invoke(listener, connection, packet);
			} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
				e.printStackTrace();
			}
		}

	}

    //=====================================================\\
    //						Receiver					   \\
    //=====================================================\\

	protected static void decodehandle(ConnectionImpl connection, ByteBuf clientdata) {
// Path: src/protocolsupportpocketstuff/api/util/PocketPacketListener.java
// public interface PocketPacketListener { }
// 
// Path: src/protocolsupportpocketstuff/util/packet/serializer/PacketSerializer.java
// public class PacketSerializer {
// 
// 	public static int readPacketId(ByteBuf from) {
// 		int id = VarNumberSerializer.readVarInt(from);
// 		return id;
// 	}
// 
// }


// Path: src/protocolsupportpocketstuff/packet/PEReceiver.java
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import io.netty.buffer.ByteBuf;
import protocolsupport.api.Connection;
import protocolsupport.api.Connection.PacketListener;
import protocolsupport.api.ProtocolType;
import protocolsupport.api.utils.Any;
import protocolsupport.protocol.ConnectionImpl;
import protocolsupportpocketstuff.api.util.PocketPacketHandler;
import protocolsupportpocketstuff.api.util.PocketPacketListener;
import protocolsupportpocketstuff.util.packet.serializer.PacketSerializer;

			Set<Handler> handlers = any.getObj2();
			handlers.add(handler);
		}
	}

	public static class Handler {

		private PocketPacketListener listener;
		private Method method;

		public Handler(PocketPacketListener listener, Method method) {
			this.listener = listener;
			this.method = method;
		}

		public void handle(Connection connection, PEPacket packet) {
			try {
				method.invoke(listener, connection, packet);
			} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
				e.printStackTrace();
			}
		}

	}

    //=====================================================\\
    //						Receiver					   \\
    //=====================================================\\

	protected static void decodehandle(ConnectionImpl connection, ByteBuf clientdata) {
		int packetId = PacketSerializer.readPacketId(clientdata);