public static GsClientPacket handle(ByteBuffer data,GsConnection client){
  GsClientPacket msg=null;
  State state=client.getState();
  int id=data.get() & 0xff;
switch (state) {
case CONNECTED:
{
switch (id) {
case 0:
        msg=new CM_GS_AUTH();
      break;
case 13:
    msg=new CM_MAC();
  break;
default :
unknownPacket(state,id);
}
break;
}
case AUTHED:
{
switch (id) {
case 1:
msg=new CM_ACCOUNT_AUTH();
break;
case 2:
msg=new CM_ACCOUNT_RECONNECT_KEY();
break;
case 3:
msg=new CM_ACCOUNT_DISCONNECTED();
break;
case 4:
msg=new CM_ACCOUNT_LIST();
break;
case 5:
msg=new CM_LS_CONTROL();
break;
case 6:
msg=new CM_BAN();
break;
case 8:
msg=new CM_GS_CHARACTER();
break;
case 9:
msg=new CM_ACCOUNT_TOLL_INFO();
break;
case 10:
msg=new CM_MACBAN_CONTROL();
break;
case 11:
msg=new CM_PREMIUM_CONTROL();
break;
case 12:
msg=new CM_GS_PONG();
break;
case 13:
msg=new CM_MAC();
break;
case 14:
msg=new CM_PTRANSFER_CONTROL();
break;
default :
unknownPacket(state,id);
}
break;
}
}
if (msg != null) {
msg.setConnection(client);
msg.setBuffer(data);
}
return msg;
}

public static GsClientPacket handle ( ByteBuffer data , GsConnection client ) { GsClientPacket msg = null ; State state = client . getState ( ) ; int id = data . get ( ) & 0xff ; switch ( state ) { case CONNECTED : { switch ( id ) { case 0 : msg = new CM_GS_AUTH ( ) ; break ; case 13 : msg = new CM_MAC ( ) ; break ; default : unknownPacket ( state , id ) ; } break ; } case AUTHED : { switch ( id ) { case 1 : msg = new CM_ACCOUNT_AUTH ( ) ; break ; case 2 : msg = new CM_ACCOUNT_RECONNECT_KEY ( ) ; break ; case 3 : msg = new CM_ACCOUNT_DISCONNECTED ( ) ; break ; case 4 : msg = new CM_ACCOUNT_LIST ( ) ; break ; case 5 : msg = new CM_LS_CONTROL ( ) ; break ; case 6 : msg = new CM_BAN ( ) ; break ; case 8 : msg = new CM_GS_CHARACTER ( ) ; break ; case 9 : msg = new CM_ACCOUNT_TOLL_INFO ( ) ; break ; case 10 : msg = new CM_MACBAN_CONTROL ( ) ; break ; case 11 : msg = new CM_PREMIUM_CONTROL ( ) ; break ; case 12 : msg = new CM_GS_PONG ( ) ; break ; case 13 : msg = new CM_MAC ( ) ; break ; case 14 : msg = new CM_PTRANSFER_CONTROL ( ) ; break ; default : unknownPacket ( state , id ) ; } break ; } } if ( msg != null ) { msg . setConnection ( client ) ; msg . setBuffer ( data ) ; } return msg ; }
reads one packet from given bytebuffer
