Hi people , im in a little trouble with gnet lib , im getting the errors
StreamCorruptedException: invalid type code: 73
StreamCorruptedException: invalid type code: 00
and the error is getting at lines 92 and 49 of GnetClient.java class
In the client Side where im passing this packet:
Packet paquete = new Packet(“jugadorTocado”, 1);
paquete.addEntry(“valor”,cliente.otherPlayers.get(i).clientId +":"+ melePj.power );
cliente.servidorHost.sendPacket(paquete);
i tract the packet in the server like this:
if(arg1.getPacketName().equals("jugadorTocado"))
{
for(int i =0; i < server.getClients().size(); i++) // i send the packet to all the clients , i tryed with SendToAll() function but got same error
{
try
{
if(server.getClients().get(i).getUuid() == Integer.valueOf(String.valueOf(arg1.getEntry("valor")).split(":")[0]))
{
Packet paquete= new Packet("jugadorTocado", 1);
paquete.addEntry("valor", arg1.getEntry("valor"));
server.getClients().get(i).sendPacket(paquete);
}
}
catch(NullPointerException e)
{
System.out.print("error null pointer en reenvio de paquete de daño de player a otros players");
}
catch(IndexOutOfBoundsException e)
{
System.out.print("error out of bounds en reenvio de paquete de daño de player a otros players");
}
}
}
and when i recieve it from other player i tract like this
int lifeDept;
if(arg1.getPacketName().equals("jugadorTocado"))
{
try
{
lifeDept+= Integer.valueOf(String.valueOf(arg1.getEntry("valor")).split(":")[1]);
}
catch (NumberFormatException e)
{
lifeDept=0;
System.out.print("\n error de parseado de daño de player enemigo");
}
}
Something wrong in my code?