Browse Source

Handler written for protocol class

combat-2
MagicBot 8 months ago
parent
commit
25ab3747eb
  1. 27
      src/engine/net/client/Protocol.java

27
src/engine/net/client/Protocol.java

@ -286,6 +286,33 @@ public enum Protocol {
} }
} }
public static boolean handleClientMsg(ClientNetMsg msg) {
if (msg == null)
return false;
try {
Protocol protocol = msg.getProtocolMsg();
// Unhandled opcode
if (protocol == null)
return true;
AbstractClientMsgHandler msgHandler = protocol.handler;
if (msgHandler == null)
return true;
} catch (Exception e) {
Logger.error("handler for " + msg.getProtocolMsg() + " failed: " + e);
return false;
}
return true;
}
public static Protocol getByOpcode(int opcode) { public static Protocol getByOpcode(int opcode) {
Protocol protocol = _protocolMsgByOpcode.get(opcode); Protocol protocol = _protocolMsgByOpcode.get(opcode);

Loading…
Cancel
Save