backport some security changes

This commit is contained in:
PrototypeTrousers
2023-02-10 06:21:39 -03:00
parent 2c7b239914
commit 9a00185b6d
+6
View File
@@ -81,8 +81,11 @@ public class SecurityCache implements ISecurityGrid {
private void updateSecurityKey() {
final long lastCode = this.securityKey;
int newOwner = -1;
if (this.securityProvider.size() == 1) {
this.securityKey = this.securityProvider.get(0).getSecurityKey();
ISecurityProvider securityProvider = this.securityProvider.get(0);
newOwner = securityProvider.getOwner();
} else {
this.securityKey = -1;
}
@@ -91,6 +94,9 @@ public class SecurityCache implements ISecurityGrid {
this.getGrid().postEvent(new MENetworkSecurityChange());
for (final IGridNode n : this.getGrid().getNodes()) {
((GridNode) n).setLastSecurityKey(this.securityKey);
if (n.getPlayerID() != newOwner) {
n.setPlayerID(newOwner);
}
}
}
}