Changed admin system

This commit is contained in:
Ziggeh
2014-08-11 08:28:38 +02:00
parent f78a2672cd
commit c8ab856313
17 changed files with 140 additions and 73 deletions
-28
View File
@@ -140,9 +140,7 @@ public class LoginService implements INetworkDispatch{
client.setPassword(pass);
client.setSessionKey(generateSessionKey());
client.setAccountId(id);
//client.setAccountEmail(email);
client.setSession(session);
client.setGM(checkForGmPermission(id));
core.addClient(session, client);
@@ -156,9 +154,6 @@ public class LoginService implements INetworkDispatch{
System.out.println(client.getAccountName() + " was not added to active connections map.");
return;
}
/*if(!checkIfAccountExistInGameDB(id)) {
createAccountForGameDB(id, user, email, encryptPass);
}*/
persistSession(client);
@@ -269,29 +264,6 @@ public class LoginService implements INetworkDispatch{
}
public boolean checkForGmPermission(int id) {
try {
if (core.getConfig().getInt("ADMIN") > 0) {
return true;
}
} catch (Exception e) {
}
PreparedStatement preparedStatement;
try {
preparedStatement = databaseConnection1.preparedStatement("SELECT * FROM accounts WHERE id=" + id + "");
ResultSet resultSet = preparedStatement.executeQuery();
if(resultSet.next())
return resultSet.getBoolean("gmflag");
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
/**
* Saves session data to DB so Zone Server can link sessions to accounts.
* @param client Client that needs a session save.