Use LoginState everywhere
This commit is contained in:
@@ -28,6 +28,7 @@ import client.Client;
|
||||
import client.Disease;
|
||||
import client.Family;
|
||||
import client.FamilyEntry;
|
||||
import client.LoginState;
|
||||
import client.Mount;
|
||||
import client.SkillFactory;
|
||||
import client.inventory.Equip;
|
||||
@@ -174,7 +175,7 @@ public final class PlayerLoggedinHandler extends AbstractPacketHandler {
|
||||
boolean allowLogin = true;
|
||||
|
||||
/* is this check really necessary?
|
||||
if (state == Client.LOGIN_SERVER_TRANSITION || state == Client.LOGIN_NOTLOGGEDIN) {
|
||||
if (state == LoginState.SERVER_TRANSITION || state == LoginState.NOT_LOGGED_IN) {
|
||||
List<String> charNames = c.loadCharacterNames(c.getWorld());
|
||||
if(!newcomer) {
|
||||
charNames.remove(player.getName());
|
||||
@@ -193,11 +194,11 @@ public final class PlayerLoggedinHandler extends AbstractPacketHandler {
|
||||
if (tryAcquireAccount(accId)) { // Sync this to prevent wrong login state for double loggedin handling
|
||||
try {
|
||||
int state = c.getLoginState();
|
||||
if (state != Client.LOGIN_SERVER_TRANSITION || !allowLogin) {
|
||||
if (state != LoginState.SERVER_TRANSITION || !allowLogin) {
|
||||
c.setPlayer(null);
|
||||
c.setAccID(0);
|
||||
|
||||
if (state == Client.LOGIN_LOGGEDIN) {
|
||||
if (state == LoginState.LOGGED_IN) {
|
||||
throw new GameViolationException("Attempt to log in when already logged in");
|
||||
} else {
|
||||
c.sendPacket(PacketCreator.getAfterLoginError(7));
|
||||
@@ -205,7 +206,7 @@ public final class PlayerLoggedinHandler extends AbstractPacketHandler {
|
||||
|
||||
return;
|
||||
}
|
||||
c.updateLoginState(Client.LOGIN_LOGGEDIN);
|
||||
c.updateLoginState(LoginState.LOGGED_IN);
|
||||
} finally {
|
||||
releaseAccount(accId);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package net.server.handlers.login;
|
||||
|
||||
import client.Client;
|
||||
import client.LoginState;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import net.server.coordinator.session.SessionCoordinator;
|
||||
@@ -58,7 +59,7 @@ public final class AfterLoginHandler extends AbstractPacketHandler {
|
||||
}
|
||||
} else if (c2 == 0 && c3 == 5) {
|
||||
SessionCoordinator.getInstance().closeSession(c, false);
|
||||
c.updateLoginState(Client.LOGIN_NOTLOGGEDIN);
|
||||
c.updateLoginState(LoginState.NOT_LOGGED_IN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ package net.server.handlers.login;
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.DefaultDates;
|
||||
import client.LoginState;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
import database.account.Account;
|
||||
@@ -110,7 +111,7 @@ public final class LoginPasswordHandler implements PacketHandler {
|
||||
|
||||
c.setAccount(account);
|
||||
|
||||
if (c.getLoginState(account) > Client.LOGIN_NOTLOGGEDIN) {
|
||||
if (c.getLoginState(account) > LoginState.NOT_LOGGED_IN) {
|
||||
c.sendPacket(PacketCreator.getLoginFailed(7));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package net.server.handlers.login;
|
||||
|
||||
import client.Client;
|
||||
import client.LoginState;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import net.server.coordinator.session.SessionCoordinator;
|
||||
@@ -44,7 +45,7 @@ public final class RegisterPinHandler extends AbstractPacketHandler {
|
||||
boolean cancel = p.readByte() == 0;
|
||||
if (cancel) {
|
||||
SessionCoordinator.getInstance().closeSession(c, false);
|
||||
c.updateLoginState(Client.LOGIN_NOTLOGGEDIN);
|
||||
c.updateLoginState(LoginState.NOT_LOGGED_IN);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,6 +55,6 @@ public final class RegisterPinHandler extends AbstractPacketHandler {
|
||||
c.sendPacket(PacketCreator.pinRegistered());
|
||||
|
||||
SessionCoordinator.getInstance().closeSession(c, false);
|
||||
c.updateLoginState(Client.LOGIN_NOTLOGGEDIN);
|
||||
c.updateLoginState(LoginState.NOT_LOGGED_IN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ package net.server.handlers.login;
|
||||
|
||||
import client.Client;
|
||||
import client.Gender;
|
||||
import client.LoginState;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import net.server.Server;
|
||||
@@ -73,7 +74,7 @@ public class SetGenderHandler extends AbstractPacketHandler {
|
||||
|
||||
private void close(Client c) {
|
||||
SessionCoordinator.getInstance().closeSession(c, false);
|
||||
c.updateLoginState(Client.LOGIN_NOTLOGGEDIN);
|
||||
c.updateLoginState(LoginState.NOT_LOGGED_IN);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user