All structure terminal menus and functionalities implemented

Dropped items add nowto the buildings itemlist
Some databse work for permissions
This commit is contained in:
CharonInferar
2014-04-12 02:30:17 +02:00
parent 1ab23231f6
commit 7cd8d8d742
11 changed files with 836 additions and 150 deletions
+53
View File
@@ -542,6 +542,59 @@ public class CharacterService implements INetworkDispatch {
return false;
}
/**
* Checks the database if a player with the given first name exists
* and returns the objectID of that player.
* @param name : String
* @return objectID : long
*/
public long getPlayerOID(String name) {
if (!name.equals("")) {
long oid = 0L;
try {
PreparedStatement ps = databaseConnection.preparedStatement("SELECT * FROM characters WHERE \"firstName\"=?");
ps.setString(1, name);
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
oid = resultSet.getLong("id");
}
return oid;
}
catch (SQLException e) { e.printStackTrace(); }
}
return 0L;
}
/**
* Delivers the first name of a player
* @param oid : long
* @return firstName : String
*/
public String getPlayerFirstName(long oid) {
String name = "";
try {
PreparedStatement ps = databaseConnection.preparedStatement("SELECT * FROM characters WHERE \"id\"=?");
ps.setLong(1, oid);
ResultSet resultSet = ps.executeQuery();
while (resultSet.next()) {
name = resultSet.getString("firstName");
if (!name.equals("")) {
if (name.contains(" ")) {
name = name.split(" ")[0];
}
name = name.toLowerCase();
}
return name;
}
} catch (SQLException e) { e.printStackTrace(); }
return "";
}
/**
* Checks the database for if the object ID of the player exists.
* @param objectId Object ID to check for in the database