Added cleanup method for creature ODB.

This commit is contained in:
Light2
2014-03-30 22:04:20 +02:00
parent 6c1df547b4
commit 814f800dbf
2 changed files with 46 additions and 0 deletions
+23
View File
@@ -535,6 +535,29 @@ public class CharacterService implements INetworkDispatch {
return false;
}
/**
* Checks the database for if the object ID of the player exists.
* @param objectId Object ID to check for in the database
* @return Returns True if the player exists
*/
public boolean playerExists(long objectId) {
try {
PreparedStatement ps = databaseConnection.preparedStatement("SELECT id FROM characters WHERE id=?");
ps.setLong(1, objectId);
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;
}
private void createStarterClothing(CreatureObject creature, String raceTemplate, String profession) {
try {
ProfessionTemplateVisitor visitor = ClientFileManager.loadFile("creation/profession_defaults_" + profession + ".iff", ProfessionTemplateVisitor.class);