throw errors for multiple character with same name + world set up in config

This commit is contained in:
Stanley Dimant
2024-07-19 02:45:06 +02:00
committed by Loporrit
parent 7b456d9755
commit 626df3f861

View File

@@ -78,10 +78,16 @@ public class ServerConfigurationManager
Save();
}
var auth = currentServer.Authentications.Find(f => string.Equals(f.CharacterName, charaName, StringComparison.Ordinal) && f.WorldId == worldId);
if (auth == null) return null;
var auth = currentServer.Authentications.FindAll(f => string.Equals(f.CharacterName, charaName, StringComparison.Ordinal) && f.WorldId == worldId);
if (auth.Count >= 2)
{
_mareMediator.Publish(new NotificationMessage("Multiple Identical Characters detected", "Your Service configuration has multiple characters with the same name and world set up. Please delete the duplicates.",
NotificationType.Error));
return null;
}
if (auth.Count == 0) return null;
if (currentServer.SecretKeys.TryGetValue(auth.SecretKeyIdx, out var secretKey))
if (currentServer.SecretKeys.TryGetValue(auth.Single().SecretKeyIdx, out var secretKey))
{
return secretKey.Key;
}