Handler created for ServerInfoMsg

This commit is contained in:
2024-03-31 10:13:17 -04:00
parent b752006d6f
commit 61fca2c742
2 changed files with 49 additions and 15 deletions
@@ -0,0 +1,49 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.handlers;
import engine.exception.MsgSendException;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.ServerInfoMsg;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
import engine.server.login.LoginServerMsgHandler;
import org.pmw.tinylog.Logger;
public class ServerInfoMsgHandler extends AbstractClientMsgHandler {
public ServerInfoMsgHandler() {
super(ServerInfoMsg.class);
}
@Override
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
// Member variable declaration
ServerInfoMsg msg;
// Member variable assignment
msg = (ServerInfoMsg) baseMsg;
ServerInfoMsg sim = new ServerInfoMsg();
if (!origin.sendMsg(sim)) {
Logger.error("Failed to send message");
LoginServerMsgHandler.KickToLogin(MBServerStatics.LOGINERROR_UNABLE_TO_LOGIN, "Unable to send ServerInfoMsg to client.", origin);
}
return true;
}
}