mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-13 03:13:26 -04:00
Fixed double login bug, added gm permissions, added checks to gm commands, update your postgresql db
This commit is contained in:
@@ -133,6 +133,7 @@ public class LoginService implements INetworkDispatch{
|
||||
client.setAccountId(id);
|
||||
//client.setAccountEmail(email);
|
||||
client.setSession(session);
|
||||
client.setGM(checkForGmPermission(id));
|
||||
|
||||
core.addClient((Integer)session.getAttribute("connectionId"), client);
|
||||
|
||||
@@ -143,7 +144,7 @@ public class LoginService implements INetworkDispatch{
|
||||
persistSession(client);
|
||||
|
||||
LoginEnumCluster servers = getLoginCluster();
|
||||
LoginClusterStatus serverStatus = getLoginClusterStatus();
|
||||
LoginClusterStatus serverStatus = getLoginClusterStatus(client);
|
||||
EnumerateCharacterId characters = getEnumerateCharacterId(id);
|
||||
|
||||
LoginClientToken clientToken = new LoginClientToken(client.getSessionKey(), id, user);
|
||||
@@ -205,6 +206,18 @@ public class LoginService implements INetworkDispatch{
|
||||
|
||||
}
|
||||
|
||||
public boolean checkForGmPermission(int id) {
|
||||
PreparedStatement preparedStatement;
|
||||
try {
|
||||
preparedStatement = databaseConnection1.preparedStatement("SELECT * FROM characters WHERE \"accountId\"=" + id + "");
|
||||
ResultSet resultSet = preparedStatement.executeQuery();
|
||||
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.
|
||||
@@ -287,7 +300,7 @@ public class LoginService implements INetworkDispatch{
|
||||
* Generates LoginClusterStatus packet.
|
||||
* @return LoginClusterStatus packet.
|
||||
*/
|
||||
public LoginClusterStatus getLoginClusterStatus() {
|
||||
public LoginClusterStatus getLoginClusterStatus(Client client) {
|
||||
LoginClusterStatus clusterStatus = new LoginClusterStatus();
|
||||
ResultSet resultSet;
|
||||
try {
|
||||
@@ -302,7 +315,8 @@ public class LoginService implements INetworkDispatch{
|
||||
100,
|
||||
resultSet.getInt("statusId"),
|
||||
1,
|
||||
core.getActiveZoneClients());
|
||||
core.getActiveZoneClients(),
|
||||
client);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user