public static AionClientPacket handle(ByteBuffer data,LoginConnection client){
  AionClientPacket msg=null;
  State state=client.getState();
  int id=data.get() & 0xff;
switch (state) {
case CONNECTED:
{
switch (id) {
case 0x07:
        msg=new CM_AUTH_GG(data,client);
      break;
case 0x08:
    msg=new CM_UPDATE_SESSION(data,client);
  break;
default :
unknownPacket(state,id);
}
break;
}
case AUTHED_GG:
{
switch (id) {
case 0x0B:
msg=new CM_LOGIN(data,client);
break;
default :
unknownPacket(state,id);
}
break;
}
case AUTHED_LOGIN:
{
switch (id) {
case 0x05:
msg=new CM_SERVER_LIST(data,client);
break;
case 0x02:
msg=new CM_PLAY(data,client);
break;
default :
unknownPacket(state,id);
}
break;
}
}
return msg;
}

public static AionClientPacket handle ( ByteBuffer data , LoginConnection client ) { AionClientPacket msg = null ; State state = client . getState ( ) ; int id = data . get ( ) & 0xff ; switch ( state ) { case CONNECTED : { switch ( id ) { case 0x07 : msg = new CM_AUTH_GG ( data , client ) ; break ; case 0x08 : msg = new CM_UPDATE_SESSION ( data , client ) ; break ; default : unknownPacket ( state , id ) ; } break ; } case AUTHED_GG : { switch ( id ) { case 0x0B : msg = new CM_LOGIN ( data , client ) ; break ; default : unknownPacket ( state , id ) ; } break ; } case AUTHED_LOGIN : { switch ( id ) { case 0x05 : msg = new CM_SERVER_LIST ( data , client ) ; break ; case 0x02 : msg = new CM_PLAY ( data , client ) ; break ; default : unknownPacket ( state , id ) ; } break ; } } return msg ; }
reads one packet from given bytebuffer
