forked from MagicBane/Server
Handler written for protocol class
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user