mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-14 00:02:07 -04:00
Fixed list update issues with friend and ignore list, /findfriend now destroys existing wp's, fixed string bug on updating wps
This commit is contained in:
@@ -461,5 +461,34 @@ public class CharacterService implements INetworkDispatch {
|
||||
}
|
||||
return characters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the database for if the name of the player exists. The name is
|
||||
* formated automatically in the method for checking the database, so no conversion is required.
|
||||
* @param name Name to check for in the database
|
||||
* @return Returns True if the player exists
|
||||
*/
|
||||
public boolean playerExists(String name) {
|
||||
if (!name.equals("")) {
|
||||
if (name.contains(" ")) {
|
||||
name = name.split(" ")[0];
|
||||
}
|
||||
name = name.replace("'", "''");
|
||||
name = name.toLowerCase();
|
||||
try {
|
||||
PreparedStatement ps = databaseConnection.preparedStatement("SELECT id FROM characters WHERE LOWER(\"firstName\")=?");
|
||||
ps.setString(1, name);
|
||||
ResultSet resultSet = ps.executeQuery();
|
||||
|
||||
boolean isDuplicate = resultSet.next();
|
||||
resultSet.getStatement().close();
|
||||
if (isDuplicate) { return true; }
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
catch (SQLException e) { e.printStackTrace(); }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user