2022-04-30 09:41:17 -04:00
|
|
|
package engine.net.client.handlers;
|
|
|
|
|
|
|
|
|
|
import engine.net.client.ClientConnection;
|
|
|
|
|
import engine.net.client.msg.ClientNetMsg;
|
|
|
|
|
|
|
|
|
|
/* @Summary: This is the abstract class from which all message handlers
|
|
|
|
|
* for mainline application protocol derive. Namely those
|
|
|
|
|
* routed and executed via ClientMessageHandler.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public abstract class AbstractClientMsgHandler {
|
2023-07-15 09:23:48 -04:00
|
|
|
|
2024-05-12 11:55:12 -04:00
|
|
|
public AbstractClientMsgHandler() {
|
2023-07-15 09:23:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean handleNetMsg(ClientNetMsg msg) {
|
|
|
|
|
|
|
|
|
|
boolean executionSucceded;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
executionSucceded = _handleNetMsg(msg, (ClientConnection) msg.getOrigin());
|
2024-05-12 13:42:11 -04:00
|
|
|
} catch (Exception e) {
|
2023-07-15 09:23:48 -04:00
|
|
|
e.printStackTrace();
|
|
|
|
|
executionSucceded = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return executionSucceded;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-12 13:42:11 -04:00
|
|
|
protected abstract boolean _handleNetMsg(ClientNetMsg msg, ClientConnection origin);
|
2023-07-15 09:23:48 -04:00
|
|
|
}
|