* @param password the player password as a String
* @return a new Player if it's created, otherwise null.
* @throws GameException that inform
*/
public Player newPlayer(String email, String password) throws GameException {
Message serverResponse = servProtocol.sendRequest(Message.NEW_ACCOUNT, email + "_" + password);
if (serverResponse != null) {
switch (serverResponse.getHeader()) {
case Message.NEW_ACCOUNT_SUCCESS:
// Return the new instance of the current player
return new Player(email, password, new String(serverResponse.getBody()));
default:
exceptionTriggered(serverResponse.getHeader());
}
} else {
throw new GameException(GameException.typeErr.CONN_KO);
}
return null;