Ejemplo n.º 1
0
 private final void decodeGrab(InputStream stream) {
   if (stream.getRemaining() != 8) {
     System.out.println(" " + stream.getRemaining());
     session.getChannel().close();
     return;
   }
   session.setEncoder(0);
   if (stream.readInt() != Settings.CLIENT_BUILD
       || stream.readInt() != Settings.CUSTOM_CLIENT_BUILD) {
     session.setDecoder(-1);
     session.getGrabPackets().sendOutdatedClientPacket();
     return;
   }
   session.setDecoder(1);
   session.getGrabPackets().sendStartUpPacket();
 }
Ejemplo n.º 2
0
 private final void decodeLogin(InputStream stream) {
   if (stream.getRemaining() != 0) {
     session.getChannel().close();
     return;
   }
   session.setDecoder(2);
   session.setEncoder(1);
   session.getLoginPackets().sendStartUpPacket();
 }
Ejemplo n.º 3
0
 @Override
 public final void decode(InputStream stream) {
   session.setDecoder(-1);
   int packetId = stream.readUnsignedByte();
   switch (packetId) {
     case 14:
       decodeLogin(stream);
       break;
     case 15:
       decodeGrab(stream);
       break;
     default:
       if (Settings.DEBUG) Logger.log(this, "PacketId " + packetId);
       session.getChannel().close();
       break;
   }
 }