Handler written for protocol class

This commit is contained in:
2024-03-29 10:07:33 -04:00
parent 7526cc808c
commit 25ab3747eb
+27
View File
@@ -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) {
Protocol protocol = _protocolMsgByOpcode.get(opcode);