Exemplo n.º 1
0
 private PacketProcessor() {
   int maxRecvOp = 0;
   for (RecvPacketOpcode op : RecvPacketOpcode.values()) {
     if (op.getValue() > maxRecvOp) {
       maxRecvOp = op.getValue();
     }
   }
   this.handlers = new MaplePacketHandler[maxRecvOp + 1];
 }
Exemplo n.º 2
0
 public void registerHandler(RecvPacketOpcode code, MaplePacketHandler handler) {
   try {
     this.handlers[code.getValue()] = handler;
   } catch (ArrayIndexOutOfBoundsException e) {
     System.out.println("Error while registering handler - " + handler.toString());
   }
 }