Browse Source

login crash bug

lakebane-master
FatBoy-DOTC 10 months ago
parent
commit
0759c56b14
  1. 30
      src/engine/objects/PlayerCharacter.java
  2. 31
      src/engine/server/login/LoginServerMsgHandler.java

30
src/engine/objects/PlayerCharacter.java

@ -753,36 +753,6 @@ public class PlayerCharacter extends AbstractCharacter { @@ -753,36 +753,6 @@ public class PlayerCharacter extends AbstractCharacter {
public static PlayerCharacter generatePCFromCommitNewCharacterMsg(Account a, CommitNewCharacterMsg msg, ClientConnection clientConnection) {
String firstName = msg.getFirstName().trim();
String lastName = msg.getLastName().trim();
if (firstName.length() < 3) {
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_FIRSTNAME_MUST_BE_LONGER,
clientConnection);
return null;
}
// Ensure names are below required length
if (firstName.length() > 15 || lastName.length() > 15) {
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_FIRSTANDLAST_MUST_BE_SHORTER,
clientConnection);
return null;
}
// Check if firstname is valid
if (MiscUtils.checkIfFirstNameInvalid(firstName)) {
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_PLEASE_CHOOSE_ANOTHER_FIRSTNAME,
clientConnection);
return null;
}
// Check if last name is valid
if (MiscUtils.checkIfLastNameInvalid(lastName)) {
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_LASTNAME_UNAVAILABLE,
clientConnection);
return null;
}
// Verify Race
int raceID = msg.getRace();

31
src/engine/server/login/LoginServerMsgHandler.java

@ -30,6 +30,7 @@ import engine.server.MBServerStatics; @@ -30,6 +30,7 @@ import engine.server.MBServerStatics;
import engine.session.CSSession;
import engine.session.Session;
import engine.util.ByteUtils;
import engine.util.MiscUtils;
import engine.util.StringUtils;
import org.pmw.tinylog.Logger;
@ -343,12 +344,40 @@ public class LoginServerMsgHandler implements NetMsgHandler { @@ -343,12 +344,40 @@ public class LoginServerMsgHandler implements NetMsgHandler {
this.sendCharacterSelectScreen(session);
return;
}
String firstName = commitNewCharacterMessage.getFirstName().trim();
String lastName = commitNewCharacterMessage.getLastName().trim();
if (firstName.length() < 3) {
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_FIRSTNAME_MUST_BE_LONGER,
clientConnection);
return;
}
// Ensure names are below required length
if (firstName.length() > 15 || lastName.length() > 15) {
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_FIRSTANDLAST_MUST_BE_SHORTER,
clientConnection);
return;
}
// Check if firstname is valid
if (MiscUtils.checkIfFirstNameInvalid(firstName)) {
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_PLEASE_CHOOSE_ANOTHER_FIRSTNAME,
clientConnection);
return;
}
// Check if last name is valid
if (MiscUtils.checkIfLastNameInvalid(lastName)) {
LoginServerMsgHandler.sendInvalidNameMsg(firstName, lastName, MBServerStatics.INVALIDNAME_LASTNAME_UNAVAILABLE,
clientConnection);
return;
}
PlayerCharacter pc = PlayerCharacter.generatePCFromCommitNewCharacterMsg(session.getAccount(), commitNewCharacterMessage, clientConnection);
if (pc == null) {
Logger.info("Player returned null while creating character.");
//this.sendCharacterSelectScreen(session, true);
this.sendCharacterSelectScreen(session, true);
return;
}
PlayerCharacter.initializePlayer(pc);

Loading…
Cancel
Save