From 63bf0b6070cbd4276ee2a597c0d826d53949ee4d Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 10 Sep 2023 13:43:28 -0400 Subject: [PATCH] Handler created for AttackMsg --- .../client/handlers/AttackCmdMsgHandler.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/engine/net/client/handlers/AttackCmdMsgHandler.java diff --git a/src/engine/net/client/handlers/AttackCmdMsgHandler.java b/src/engine/net/client/handlers/AttackCmdMsgHandler.java new file mode 100644 index 00000000..22b456d5 --- /dev/null +++ b/src/engine/net/client/handlers/AttackCmdMsgHandler.java @@ -0,0 +1,48 @@ +package engine.net.client.handlers; + +import engine.Enum.DispatchChannel; +import engine.exception.MsgSendException; +import engine.net.Dispatch; +import engine.net.DispatchMessage; +import engine.net.client.ClientConnection; +import engine.net.client.msg.AttackCmdMsg; +import engine.net.client.msg.ClientNetMsg; +import engine.net.client.msg.KeepAliveServerClientMsg; +import engine.objects.PlayerCharacter; + +/* + * @Author: + * @Summary: Processes application protocol message which keeps + * client's tcp connection open. + */ + +public class AttackCmdMsgHandler extends AbstractClientMsgHandler { + + public AttackCmdMsgHandler() { + super(AttackCmdMsg.class); + } + + @Override + protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { + + PlayerCharacter pc = origin.getPlayerCharacter(); + + + // Member variable declaration + + KeepAliveServerClientMsg msg; + + // Member variable assignment + + msg = (KeepAliveServerClientMsg) baseMsg; + + + // Send ping to client + + Dispatch dispatch = Dispatch.borrow(pc, msg); + DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY); + + return true; + } + +} \ No newline at end of file