Handle conflicting connection attempts gracefully

This commit is contained in:
Brant Martin
2019-06-25 16:11:13 -04:00
committed by GitHub
parent ecbbd6fbf2
commit 4f30a47c07

View File

@@ -219,7 +219,12 @@ namespace Torch.Server.Managers
_log.Info($"Connection attempt by {steamId} from {ip}");
if (Torch.CurrentSession.KeenSession.OnlineMode == MyOnlineModeEnum.OFFLINE &&
if (Players.ContainsKey(steamId))
{
_log.Warn($"Player {steamId} already has already joined!");
UserRejected(steamId, JoinResult.AlreadyJoined);
}
else if (Torch.CurrentSession.KeenSession.OnlineMode == MyOnlineModeEnum.OFFLINE &&
promoteLevel < MyPromoteLevel.Admin)
{
_log.Warn($"Rejecting user {steamId}, world is set to offline and user is not admin.");