forked from MagicBane/Server
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.8 KiB
74 lines
2.8 KiB
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . |
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· |
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ |
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ |
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ |
|
// Magicbane Emulator Project © 2013 - 2022 |
|
// www.magicbane.com |
|
|
|
package engine.net.client.handlers; |
|
|
|
import engine.net.client.ClientConnection; |
|
import engine.net.client.msg.ClientNetMsg; |
|
import engine.net.client.msg.login.VersionInfoMsg; |
|
import engine.objects.PlayerCharacter; |
|
import engine.server.MBServerStatics; |
|
import engine.server.login.LoginServer; |
|
|
|
public class VersionInfoMsgHandler extends AbstractClientMsgHandler { |
|
|
|
public VersionInfoMsgHandler() { |
|
super(); |
|
} |
|
|
|
@Override |
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) { |
|
|
|
PlayerCharacter playerCharacter = origin.getPlayerCharacter(); |
|
String cMajorVer; |
|
String cMinorVer; |
|
VersionInfoMsg outVim; |
|
|
|
// Member variable declaration |
|
|
|
VersionInfoMsg msg; |
|
|
|
// Member variable assignment |
|
|
|
msg = (VersionInfoMsg) baseMsg; |
|
|
|
cMajorVer = msg.getMajorVersion(); |
|
cMinorVer = msg.getMinorVersion(); |
|
|
|
if (!cMajorVer.equals(LoginServer.getDefaultVersionInfo().getMajorVersion())) { |
|
LoginServer.KickToLogin(MBServerStatics.LOGINERROR_INCORRECT_CLIENT_VERSION, "Major Version Failure: " + cMajorVer, origin); |
|
return true; |
|
} |
|
|
|
/* if (!cMinorVer.equals(this.server.getDefaultVersionInfo().getMinorVersion())) { |
|
this.KickToLogin(MBServerStatics.LOGINERROR_INCORRECT_CLIENT_VERSION, "Minor Version Failure: " + cMinorVer, cc); |
|
return; |
|
} */ |
|
|
|
if (cMinorVer == null) { |
|
LoginServer.KickToLogin(MBServerStatics.LOGINERROR_INCORRECT_CLIENT_VERSION, "Minor Version Failure: ", origin); |
|
return true; |
|
} |
|
|
|
if (cMinorVer.length() < 8 || cMinorVer.length() > 16) { |
|
LoginServer.KickToLogin(MBServerStatics.LOGINERROR_INCORRECT_CLIENT_VERSION, "Minor Version Failure: ", origin); |
|
return true; |
|
} |
|
|
|
// set MachineID for this connection |
|
|
|
origin.machineID = cMinorVer; |
|
|
|
// send fake right back to the client |
|
outVim = new VersionInfoMsg(msg.getMajorVersion(), LoginServer.getDefaultVersionInfo().getMinorVersion()); |
|
origin.sendMsg(outVim); |
|
|
|
return true; |
|
} |
|
|
|
} |