Mathy 345 Posted September 30, 2016 Report Share Posted September 30, 2016 Hey guys, Holy crap I can't actually believe I am writing another help thread, feel like a noob haha. Although I never dealt with this kind of error so here we go. It basically talks about unhandled packets and stuff. I tried adding a gamble system and it gives me the error when I ask to gamble another player. Here are the errors: [9/29/16 7:26 PM]: Unhandled packet type: 123 - size: 0 [9/29/16 7:26 PM]: Unhandled packet type: 15 - size: 0 [9/29/16 7:26 PM]: Unhandled packet type: 229 - size: 0 [9/29/16 7:26 PM]: Unhandled packet type: 138 - size: 0 [9/29/16 7:26 PM]: Unhandled packet type: 197 - size: 0 [9/29/16 7:26 PM]: Unhandled packet type: 233 - size: 0 And all I added were those packets: packetId[142] = new GambleResponse(); packetId[143] = new GambleResponse(); And this is GambleResponse: package server.model.players.packets; import server.event.CycleEvent; import server.event.CycleEventContainer; import server.event.CycleEventHandler; import server.model.players.Client; import server.model.players.PacketType; import server.model.players.Player; import server.model.players.PlayerHandler; public class GambleResponse implements PacketType { @Override public void processPacket(Client c, int packetType, int packetSize) { int clientId = c.getInStream().readSignedWordBigEndian(); if (clientId < 0) return; Player o = PlayerHandler.players[clientId]; if (o == null) return; if (!c.inGambleZone() || !o.inGambleZone()) return; if (c.goodDistance(o.getX(), o.getY(), c.getX(), o.getY(), 1) && o.goodDistance(c.getX(), c.getY(), o.getX(), o.getY(), 1)) { if (packetType == 142) c.getGambling().answerRequest((Client) o); else if (packetType == 143) c.getGambling().openOptions((Client) o); return; } CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() { @Override public void execute(CycleEventContainer container) { if (c.goodDistance(o.getX(), o.getY(), c.getX(), o.getY(), 1) && o.goodDistance(c.getX(), c.getY(), o.getX(), o.getY(), 1)) { if (packetType == 142) c.getGambling().answerRequest((Client) o); else if (packetType == 143) c.getGambling().openOptions((Client) o); container.stop(); } } @Override public void stop() { // TODO Auto-generated method stub } }, 1); } } Link to comment Share on other sites More sharing options...
Daniel0576 12 Posted September 30, 2016 Report Share Posted September 30, 2016 5 minutes ago, mathy said: Hey guys, Holy crap I can't actually believe I am writing another help thread, feel like a noob haha. Although I never dealt with this kind of error so here we go. It basically talks about unhandled packets and stuff. I tried adding a gamble system and it gives me the error when I ask to gamble another player. Here are the errors: [9/29/16 7:26 PM]: Unhandled packet type: 123 - size: 0 [9/29/16 7:26 PM]: Unhandled packet type: 15 - size: 0 [9/29/16 7:26 PM]: Unhandled packet type: 229 - size: 0 [9/29/16 7:26 PM]: Unhandled packet type: 138 - size: 0 [9/29/16 7:26 PM]: Unhandled packet type: 197 - size: 0 [9/29/16 7:26 PM]: Unhandled packet type: 233 - size: 0 And all I added were those packets: packetId[142] = new GambleResponse(); packetId[143] = new GambleResponse(); And this is GambleResponse: package server.model.players.packets; import server.event.CycleEvent; import server.event.CycleEventContainer; import server.event.CycleEventHandler; import server.model.players.Client; import server.model.players.PacketType; import server.model.players.Player; import server.model.players.PlayerHandler; public class GambleResponse implements PacketType { @Override public void processPacket(Client c, int packetType, int packetSize) { int clientId = c.getInStream().readSignedWordBigEndian(); if (clientId < 0) return; Player o = PlayerHandler.players[clientId]; if (o == null) return; if (!c.inGambleZone() || !o.inGambleZone()) return; if (c.goodDistance(o.getX(), o.getY(), c.getX(), o.getY(), 1) && o.goodDistance(c.getX(), c.getY(), o.getX(), o.getY(), 1)) { if (packetType == 142) c.getGambling().answerRequest((Client) o); else if (packetType == 143) c.getGambling().openOptions((Client) o); return; } CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() { @Override public void execute(CycleEventContainer container) { if (c.goodDistance(o.getX(), o.getY(), c.getX(), o.getY(), 1) && o.goodDistance(c.getX(), c.getY(), o.getX(), o.getY(), 1)) { if (packetType == 142) c.getGambling().answerRequest((Client) o); else if (packetType == 143) c.getGambling().openOptions((Client) o); container.stop(); } } @Override public void stop() { // TODO Auto-generated method stub } }, 1); } } Add me on my newer skype Skype: gear.haze i can maybe help gotta look at the code more. Link to comment Share on other sites More sharing options...
Arithium 30 Posted September 30, 2016 Report Share Posted September 30, 2016 Make sure that your actually reading the full packet. Otherwise you'll be incorrectly reading the next packet in the queue. Client -> Server buffer.writeShort(value); buffer.writeByte(value2); Server int value = buffer.readShort(); byte value2 = buffer.readByte(); Link to comment Share on other sites More sharing options...
Mathy 345 Posted September 30, 2016 Author Report Share Posted September 30, 2016 2 hours ago, Arithium said: Make sure that your actually reading the full packet. Otherwise you'll be incorrectly reading the next packet in the queue. Client -> Server buffer.writeShort(value); buffer.writeByte(value2); Server int value = buffer.readShort(); byte value2 = buffer.readByte(); I've been able to get more info on the error, these are the packet sizes in client.java: public static final int PACKET_SIZES[] = { 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, //0 0, 0, 0, 0, 4, 0, 6, 2, 2, 0, //10 0, 2, 0, 6, 0, 12, 0, 0, 0, 0, //20 0, 0, 0, 0, 0, 8, 4, 0, 0, 2, //30 2, 6, 0, 6, 0, -1, 0, 0, 0, 0, //40 0, 0, 0, 12, 0, 0, 0, 8, 8, 12, //50 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, //60 6, 0, 2, 2, 8, 6, 0, -1, 0, 6, //70 0, 0, 0, 0, 0, 1, 4, 6, 0, 0, //80 0, 0, 0, 0, 0, 3, 0, 0, -1, 0, //90 0, 13, 0, -1, 0, 0, 0, 0, 0, 0,//100 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, //110 1, 0, 6, 0, 0, 0, -1, 0, 2, 6, //120 0, 4, 6, 8, 0, 6, 0, 0, 0, 2, //130 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, //140 0, 0, 1, 2, 0, 2, 6, 0, 0, 0, //150 0, 0, 0, 0, -1, -1, 0, 0, 0, 0,//160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //170 0, 8, 0, 3, 0, 2, 0, 0, 8, 1, //180 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, //190 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, //200 4, 0, 0, 0, 7, 8, 0, 0, 10, 0, //210 0, 0, 0, 0, 0, 0, -1, 0, 6, 0, //220 1, 0, 0, 0, 6, 0, 6, 8, 1, 0, //230 0, 4, 0, 0, 0, 0, -1, 0, -1, 4,//240 0, 0, 6, 6, 0, 0, 0 //250 } As you can see, for example, 15 has a size of 4 but in the error it says that its size is 0.. Link to comment Share on other sites More sharing options...
Arithium 30 Posted September 30, 2016 Report Share Posted September 30, 2016 1 hour ago, mathy said: I've been able to get more info on the error, these are the packet sizes in client.java: public static final int PACKET_SIZES[] = { 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, //0 0, 0, 0, 0, 4, 0, 6, 2, 2, 0, //10 0, 2, 0, 6, 0, 12, 0, 0, 0, 0, //20 0, 0, 0, 0, 0, 8, 4, 0, 0, 2, //30 2, 6, 0, 6, 0, -1, 0, 0, 0, 0, //40 0, 0, 0, 12, 0, 0, 0, 8, 8, 12, //50 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, //60 6, 0, 2, 2, 8, 6, 0, -1, 0, 6, //70 0, 0, 0, 0, 0, 1, 4, 6, 0, 0, //80 0, 0, 0, 0, 0, 3, 0, 0, -1, 0, //90 0, 13, 0, -1, 0, 0, 0, 0, 0, 0,//100 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, //110 1, 0, 6, 0, 0, 0, -1, 0, 2, 6, //120 0, 4, 6, 8, 0, 6, 0, 0, 0, 2, //130 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, //140 0, 0, 1, 2, 0, 2, 6, 0, 0, 0, //150 0, 0, 0, 0, -1, -1, 0, 0, 0, 0,//160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //170 0, 8, 0, 3, 0, 2, 0, 0, 8, 1, //180 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, //190 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, //200 4, 0, 0, 0, 7, 8, 0, 0, 10, 0, //210 0, 0, 0, 0, 0, 0, -1, 0, 6, 0, //220 1, 0, 0, 0, 6, 0, 6, 8, 1, 0, //230 0, 4, 0, 0, 0, 0, -1, 0, -1, 4,//240 0, 0, 6, 6, 0, 0, 0 //250 } As you can see, for example, 15 has a size of 4 but in the error it says that its size is 0.. I see your problem. Line with the // 140, count them from the start. 140, 141, 142, 143, make 142 and 143 with a packet size of 2. Link to comment Share on other sites More sharing options...
Mathy 345 Posted October 1, 2016 Author Report Share Posted October 1, 2016 3 hours ago, Arithium said: I see your problem. Line with the // 140, count them from the start. 140, 141, 142, 143, make 142 and 143 with a packet size of 2. I did, the interface wont come up so I set it to 4, still nothing then to 6, now it shows up but I can't put up any items on the interface so I set it to 8, same thing then 10 and I stopped there lol Link to comment Share on other sites More sharing options...
Arithium 30 Posted October 1, 2016 Report Share Posted October 1, 2016 You only need a packet size of 2 since this is all your reading. int clientId = c.getInStream().readSignedWordBigEndian(); Link to comment Share on other sites More sharing options...
Mathy 345 Posted October 1, 2016 Author Report Share Posted October 1, 2016 (edited) 1 minute ago, Arithium said: You only need a packet size of 2 since this is all your reading. int clientId = c.getInStream().readSignedWordBigEndian(); Idk how to show you what it does.. Mind adding me on Skype ? sakoofortin Edited October 1, 2016 by mathy Link to comment Share on other sites More sharing options...
Mathy 345 Posted October 8, 2016 Author Report Share Posted October 8, 2016 Still need help ! Link to comment Share on other sites More sharing options...
Azzheater 0 Posted December 14, 2021 Report Share Posted December 14, 2021 switch the packet size Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now