private PacketProcessor() { int maxRecvOp = 0; for (RecvOpcode op : RecvOpcode.values()) { if (op.getValue() > maxRecvOp) { maxRecvOp = op.getValue(); } } handlers = new MaplePacketHandler[maxRecvOp + 1]; }
public void registerHandler(RecvOpcode code, MaplePacketHandler handler) { try { handlers[code.getValue()] = handler; } catch (ArrayIndexOutOfBoundsException e) { Output.print("Error registering handler - " + code.name()); } }