Exemplo n.º 1
0
        internal void InvokeServerLeave(int who)
        {
            LeaveEventArgs args = new LeaveEventArgs
            {
                Who = who
            };

            this.ServerLeave.Invoke(args);
        }
Exemplo n.º 2
0
 private void onPlayerLeave(TerrariaApi.Server.LeaveEventArgs e)
 {
     lock (players)
         for (int i = 0; i < players.Count; i++)
         {
             if (players[i].index == e.Who)
             {
                 players.RemoveAt(i);
                 break;
             }
         }
 }
Exemplo n.º 3
0
        private void OnLeave(LeaveEventArgs args)
        {
            int id = -1;

            if (indexid.ContainsKey(args.Who))
                id = indexid[args.Who];
            else
                return;

            if (id != -1 && players.ContainsKey(id))
            {
                players[id].Leave();

                players[id].pastGreet = false;
                players[id].hasGreeted = false;

                indexid.Remove(args.Who);
            }
        }
Exemplo n.º 4
0
 public void OnLeave(LeaveEventArgs e)
 {
     Spying[e.Who] = false;
     InStaffChat[e.Who] = false;
 }
Exemplo n.º 5
0
		internal void InvokeServerLeave(int who)
		{
			LeaveEventArgs args = new LeaveEventArgs
			{
				Who = who
			};

			this.ServerLeave.Invoke(args);
		}
Exemplo n.º 6
0
 public void OnLeave(LeaveEventArgs args)
 {
     Playerlist[args.Who] = null;
 }
Exemplo n.º 7
0
 internal void OnLeave(LeaveEventArgs args)
 {
     lock (C3Mod.C3Players)
     {
         for (int i = 0; i < C3Mod.C3Players.Count; i++)
         {
             if (C3Mod.C3Players[i].Index == args.Who)
             {
                 C3Mod.C3Players.RemoveAt(i);
                 break;
             }
         }
     }
 }
Exemplo n.º 8
0
        /// <summary>OnLeave - Called when a player leaves the server.</summary>
        /// <param name="args">args - The LeaveEventArgs object.</param>
        private void OnLeave(LeaveEventArgs args)
        {
            var tsplr = Players[args.Who];
            Players[args.Who] = null;

            if (tsplr != null && tsplr.ReceivedInfo)
            {
                if (!tsplr.SilentKickInProgress && tsplr.State >= 3)
                    Utils.Broadcast(tsplr.Name + " has left.", Color.Yellow);
                Log.Info("{0} disconnected.", tsplr.Name);

                if (tsplr.IsLoggedIn && !tsplr.IgnoreActionsForClearingTrashCan && Main.ServerSideCharacter && (!tsplr.Dead || tsplr.TPlayer.difficulty != 2))
                {
                    tsplr.PlayerData.CopyCharacter(tsplr);
                    CharacterDB.InsertPlayerData(tsplr);
                }

                if (Config.RememberLeavePos && !tsplr.LoginHarassed)
                {
                    RememberedPos.InsertLeavePos(tsplr.Name, tsplr.IP, (int)(tsplr.X / 16), (int)(tsplr.Y / 16));
                }

                if (tsplr.tempGroupTimer != null)
                {
                    tsplr.tempGroupTimer.Stop();
                }
            }

            // Fire the OnPlayerLogout hook too, if the player was logged in and they have a TSPlayer object.
            if (tsplr != null && tsplr.IsLoggedIn)
            {
                Hooks.PlayerHooks.OnPlayerLogout(tsplr);
            }

            // The last player will leave after this hook is executed.
            if (Utils.ActivePlayers() == 1)
            {
                if (Config.SaveWorldOnLastPlayerExit)
                    SaveManager.Instance.SaveWorld();
                SetConsoleTitle(true);
            }
        }
Exemplo n.º 9
0
        void OnLeave(LeaveEventArgs e)
        {
            string name = Main.player[e.Who].name;

              ClanMember member = ClanManager.getClanMember(name);
              if (member == null)
            return;
              else
            member.Index = -1;

              ClanManager.PendingInvites[e.Who].Timeout = 0;
        }
Exemplo n.º 10
0
 private static void OnLeave(LeaveEventArgs plr)
 {
     try
     {
         var player = GetPlayerByIndex(plr.Who);
         if (player != null)
         {
             if (player.UserID != -1)
             {
                 AdminToolsMain.db.QueryReader("UPDATE PlayerData SET Nicknames=@1, IPs=@2, LastSeen=@3 WHERE UserID=@0", player.UserID, JsonConvert.SerializeObject(player.Nicknames, Formatting.None), JsonConvert.SerializeObject(player.IP, Formatting.None), DateTime.Now.Ticks);
             }
             lock (PlayerList)
             {
                 PlayerList.Remove(player);
             }
         }
     }
     catch (Exception ex)
     {
         TShock.Log.ConsoleError(ex.ToString());
     }
 }
        /// <summary>
        /// ServerLeave Event
        /// Automatically executes the "save" command when
        /// the last player has left the server.
        /// </summary>
        /// <param name="args">LeaveEvent Parameters. Has a "who" parameter which corresponds
        /// to the leaving player's index</param>
        private void OnPlayerLeaveServer(LeaveEventArgs args)
        {
            // Get the currrent player count
            int playerCount = TShock.Utils.ActivePlayers();

            // is this the last player and is able to save?
            if (playerCount <= 1 && canSave == true)
            {
                TShock.Utils.SaveWorld();

                lastSaved   = DateTime.Now;
                canSave     = false;
            }
        }
Exemplo n.º 12
0
 private void OnLeave(LeaveEventArgs args)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 13
0
 private void OnLeave(LeaveEventArgs args)
 {
     if (storage.ContainsKey(args.Who))
         {
             storage.Remove(args.Who);
         }
 }
Exemplo n.º 14
0
 private void OnLeave(LeaveEventArgs e)
 {
     if (TShock.Players[e.Who] != null && ChatPlayers[e.Who] != null)
     {
         UpdateList(e.Who, false);
     }
 }
Exemplo n.º 15
0
 void OnLeave(LeaveEventArgs e)
 {
     ClanManager.UnLoadMember(TShock.Players[e.Who]);
 }
Exemplo n.º 16
0
        ///<summary>
        /// This event happens every time a player leaves the server.
        ///</summary>
        ///<param name="args">Containing event data.</param>
        private void OnLeave(LeaveEventArgs args)
        {
            if (this.myPlayersData.ContainsKey(TShock.Players[args.Who].Index)) {

                this.myPlayersData.Remove(TShock.Players[args.Who].Index);
            }
        }
Exemplo n.º 17
0
        private void OnLeave(LeaveEventArgs args)
        {
            if (TShock.Utils.ActivePlayers() == 1)
            {
                foreach (var pair in bossList)
                {
                    if (pair.Value > 0 && pair.Value < Main.maxNPCs)
                    {
                        TSPlayer.Server.StrikeNPC(pair.Value, 9999, 1f, 1);
                    }
                }
                bossList.Clear();
                bossCounts.Clear();
                Timers.Stop();

                TShock.Log.ConsoleInfo("[AutoBoss+] Timer Disabled: No players are online");
            }
        }
Exemplo n.º 18
0
 void OnLeave(LeaveEventArgs e)
 {
     Spams[e.Who] = 0.0;
     Times[e.Who] = DateTime.Now;
 }
Exemplo n.º 19
0
 void OnLeave(LeaveEventArgs e)
 {
     Infos[e.Who] = new PlayerInfo();
 }
Exemplo n.º 20
0
 void OnLeave(LeaveEventArgs e)
 {
     Action[e.Who] = SignAction.NONE;
     SignNum[e.Who] = false;
 }
Exemplo n.º 21
0
        public void OnLeave(LeaveEventArgs args)
        {
            var plr = TShock.Players[args.Who];
            if (plr == null)
                return;

            if (hasAnnounced.Keys.Contains(args.Who))
                hasAnnounced.Remove(args.Who);

            if (!plr.IsLoggedIn)
                return;

            if (permas.ContainsKey(plr.User.ID))
                permas.Remove(plr.User.ID);
        }
Exemplo n.º 22
0
 public void OnLeave(LeaveEventArgs e)
 {
     lock (EBPlayers)
     {
         for (int i = 0; i < EBPlayers.Count; i++)
         {
             if (EBPlayers[i].Index == e.Who)
             {
                 EBPlayers.RemoveAt(i);
                 break;
             }
         }
     }
 }
Exemplo n.º 23
0
Arquivo: Main.cs Projeto: ja450n/Vault
 public void OnLeave(LeaveEventArgs e)
 {
     try
     {
         if (PlayerList[e.Who] != null)
             PlayerList[e.Who].StopUpdating();
         PlayerList[e.Who] = null;
     }
     catch (Exception ex)
     {
         Log.ConsoleError(ex.ToString());
         if (e.Who >= 0)
             PlayerList[e.Who] = null;
     }
 }
Exemplo n.º 24
0
 private static void OnLeave(LeaveEventArgs args)
 {
     //if (ScPlayers[args.Who] != null && ScPlayers[args.Who].Cooldowns.Count > 0)
       //    OfflineCooldowns.Add(TShock.Players[args.Who].Name, ScPlayers[args.Who].Cooldowns);
       ScPlayers[args.Who] = null;
 }
Exemplo n.º 25
0
 void OnLeave(LeaveEventArgs args)
 {
     RPlayers[args.Who] = null;
 }
Exemplo n.º 26
0
 private void OnLeave(LeaveEventArgs args)
 {
     lock (Players)
     {
         Players.RemoveAll(p => p.Index == args.Who);
     }
 }
Exemplo n.º 27
0
 void OnLeave(LeaveEventArgs e)
 {
     TSPlayer tsplr = TShock.Players[e.Who];
     if (!IrcClient.IsConnected)
         Connect();
     else if (tsplr != null && tsplr.ReceivedInfo && tsplr.State >= 3 && !tsplr.SilentKickInProgress)
     {
         if (!String.IsNullOrEmpty(Config.ServerLeaveMessageFormat))
             SendMessage(Config.Channel, String.Format(Config.ServerLeaveMessageFormat, tsplr.Name));
         if (!String.IsNullOrEmpty(Config.ServerLeaveAdminMessageFormat))
             SendMessage(Config.AdminChannel, String.Format(Config.ServerLeaveAdminMessageFormat, tsplr.Name, tsplr.IP));
     }
 }
Exemplo n.º 28
0
 public void OnLeave(LeaveEventArgs args)
 {
     if (scPlayers[args.Who] != null && scPlayers[args.Who].Cooldowns.Count > 0)
         OfflineCooldowns.Add(TShock.Players[args.Who].Name, scPlayers[args.Who].Cooldowns);
     scPlayers[args.Who] = null;
 }
Exemplo n.º 29
0
        public void OnLeave(LeaveEventArgs e)
        {
            TSPlayer ts = TShock.Players[e.Who];
            int i = FrozenPlayers.FindIndex(f => f.Index == e.Who);
            if (i >= 0)
            {
                if (!IpNames.ContainsKey(ts.IP))
                    IpNames.Add(ts.IP, ts.Name);

                FrozenPlayers.RemoveAt(i);
            }
        }
Exemplo n.º 30
0
 private void OnLeave(LeaveEventArgs args)
 {
     lock (players)
     {
         players[args.Who] = null;
     }
 }
Exemplo n.º 31
0
        private void OnLeave(LeaveEventArgs args)
        {
            var player = Utils.GetPlayers(args.Who);

            Players.RemoveAll(pl => pl.Index == args.Who);
        }
Exemplo n.º 32
0
 void OnLeave(LeaveEventArgs e)
 {
     Build[e.Who] = false;
 }