Rename AccountService methods
This commit is contained in:
@@ -4,7 +4,7 @@ package client;
|
|||||||
* @author Ponk
|
* @author Ponk
|
||||||
*/
|
*/
|
||||||
public class LoginState {
|
public class LoginState {
|
||||||
public static final byte NOT_LOGGED_IN = 0;
|
public static final byte NOT_LOGGED_IN = 0; // TODO: rename to LOGGED_OUT
|
||||||
public static final byte SERVER_TRANSITION = 1;
|
public static final byte SERVER_TRANSITION = 1;
|
||||||
public static final byte LOGGED_IN = 2;
|
public static final byte LOGGED_IN = 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ public final class PlayerLoggedinHandler extends AbstractPacketHandler {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
accountService.logIn(c);
|
accountService.setLoggedIn(c);
|
||||||
} finally {
|
} finally {
|
||||||
releaseAccount(accId);
|
releaseAccount(accId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public final class AcceptToSHandler extends AbstractPacketHandler {
|
|||||||
throw new GameViolationException("ToS not accepted");
|
throw new GameViolationException("ToS not accepted");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!accountService.logIn(c)) {
|
if (!accountService.setLoggedIn(c)) {
|
||||||
c.sendPacket(PacketCreator.getLoginFailed(7));
|
c.sendPacket(PacketCreator.getLoginFailed(7));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public final class AfterLoginHandler extends AbstractPacketHandler {
|
|||||||
c.sendPacket(PacketCreator.requestPinAfterFailure());
|
c.sendPacket(PacketCreator.requestPinAfterFailure());
|
||||||
}
|
}
|
||||||
} else if (c2 == 0 && c3 == 5) {
|
} else if (c2 == 0 && c3 == 5) {
|
||||||
accountService.logOut(c);
|
accountService.setLoggedOutAndDisconnect(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public final class LoginPasswordHandler implements PacketHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!accountService.logIn(c)) {
|
if (!accountService.setLoggedIn(c)) {
|
||||||
c.sendPacket(PacketCreator.getLoginFailed(7));
|
c.sendPacket(PacketCreator.getLoginFailed(7));
|
||||||
}
|
}
|
||||||
removeOnlineAccountChrs(c);
|
removeOnlineAccountChrs(c);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public final class RegisterPinHandler extends AbstractPacketHandler {
|
|||||||
public void handlePacket(InPacket p, Client c) {
|
public void handlePacket(InPacket p, Client c) {
|
||||||
boolean cancel = p.readByte() == 0;
|
boolean cancel = p.readByte() == 0;
|
||||||
if (cancel) {
|
if (cancel) {
|
||||||
accountService.logOut(c);
|
accountService.setLoggedOutAndDisconnect(c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,6 +51,6 @@ public final class RegisterPinHandler extends AbstractPacketHandler {
|
|||||||
c.setPin(pin);
|
c.setPin(pin);
|
||||||
c.sendPacket(PacketCreator.pinRegistered());
|
c.sendPacket(PacketCreator.pinRegistered());
|
||||||
|
|
||||||
accountService.logOut(c);
|
accountService.setLoggedOutAndDisconnect(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class SetGenderHandler extends AbstractPacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void logOut(Client c) {
|
private void logOut(Client c) {
|
||||||
accountService.logOut(c);
|
accountService.setLoggedOutAndDisconnect(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ public class AccountService {
|
|||||||
return accountRepository.setChrSlots(accountId, chrSlots);
|
return accountRepository.setChrSlots(accountId, chrSlots);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean logIn(Client c) {
|
public boolean setLoggedIn(Client c) {
|
||||||
byte newState = LoginState.LOGGED_IN;
|
byte newState = LoginState.LOGGED_IN;
|
||||||
int currentState = c.getLoginState();
|
int currentState = c.getLoginState();
|
||||||
if (currentState != LoginState.NOT_LOGGED_IN && currentState != LoginState.SERVER_TRANSITION) {
|
if (currentState != LoginState.NOT_LOGGED_IN && currentState != LoginState.SERVER_TRANSITION) {
|
||||||
@@ -224,8 +224,12 @@ public class AccountService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logOut(Client c) {
|
public void setLoggedOutAndDisconnect(Client c) {
|
||||||
SessionCoordinator.getInstance().closeSession(c, false);
|
SessionCoordinator.getInstance().closeSession(c, false);
|
||||||
|
setLoggedOut(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoggedOut(Client c) {
|
||||||
setLoginState(c, LoginState.NOT_LOGGED_IN);
|
setLoginState(c, LoginState.NOT_LOGGED_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user