public override void Connected(BoltConnection connection)
 {
     connection.SetCanReceiveEntities(false);
     if (CoopPeerStarter.DedicatedHost)
     {
         if (!string.IsNullOrEmpty(CoopDedicatedServerStarter.ServerPassword))
         {
             CoopJoinDedicatedServerToken coopJoinDedicatedServerToken = connection.ConnectToken as CoopJoinDedicatedServerToken;
             if (coopJoinDedicatedServerToken != null && coopJoinDedicatedServerToken.ServerPassword != CoopDedicatedServerStarter.ServerPassword)
             {
                 connection.Disconnect(new CoopJoinDedicatedServerFailed
                 {
                     Error = "Incorrect server password"
                 });
                 return;
             }
         }
         if (!string.IsNullOrEmpty(CoopDedicatedServerStarter.AdminPassword))
         {
             CoopJoinDedicatedServerToken coopJoinDedicatedServerToken2 = connection.ConnectToken as CoopJoinDedicatedServerToken;
             if (coopJoinDedicatedServerToken2 != null && coopJoinDedicatedServerToken2.AdminPassword == CoopDedicatedServerStarter.AdminPassword)
             {
                 AdminAuthed adminAuthed = AdminAuthed.Create(connection);
                 adminAuthed.IsAdmin = true;
                 adminAuthed.Send();
             }
         }
     }
 }
Exemple #2
0
 public override void Connected(BoltConnection connection)
 {
     connection.SetCanReceiveEntities(false);
     if (CoopPeerStarter.DedicatedHost)
     {
         if (!string.IsNullOrEmpty(CoopDedicatedServerStarter.ServerPassword))
         {
             CoopJoinDedicatedServerToken coopJoinDedicatedServerToken = connection.ConnectToken as CoopJoinDedicatedServerToken;
             if (coopJoinDedicatedServerToken != null && coopJoinDedicatedServerToken.ServerPassword != CoopDedicatedServerStarter.ServerPassword)
             {
                 connection.Disconnect(new CoopJoinDedicatedServerFailed
                 {
                     Error = "Incorrect server password"
                 });
                 return;
             }
         }
         if (!string.IsNullOrEmpty(CoopDedicatedServerStarter.AdminPassword))
         {
             CoopJoinDedicatedServerToken coopJoinDedicatedServerToken2 = connection.ConnectToken as CoopJoinDedicatedServerToken;
             if (coopJoinDedicatedServerToken2 != null && coopJoinDedicatedServerToken2.AdminPassword == CoopDedicatedServerStarter.AdminPassword)
             {
                 AdminAuthed adminAuthed = AdminAuthed.Create(connection);
                 adminAuthed.IsAdmin = true;
                 adminAuthed.Send();
             }
         }
     }
 }
 public override void Connected(BoltConnection connection)
 {
     connection.SetCanReceiveEntities(false);
     if (CoopKick.IsBanned(connection.RemoteEndPoint.SteamId))
     {
         connection.Disconnect(new CoopKickToken
         {
             Banned      = true,
             KickMessage = "HOST_BANNED_YOU_PERMANANTLY"
         });
     }
     else
     {
         CoopServerInfo.Instance.entity.Freeze(false);
     }
 }
 public override void Connected(BoltConnection connection)
 {
     connection.SetCanReceiveEntities(false);
     if (CoopKick.IsBanned(connection.RemoteEndPoint.SteamId))
     {
         connection.Disconnect(new CoopKickToken
         {
             Banned = true,
             KickMessage = "Host banned you permanently from his games"
         });
     }
     else
     {
         CoopServerInfo.Instance.entity.Freeze(false);
     }
 }