Exemplo n.º 1
0
        private void DeletePlayer(object sender, RoutedEventArgs e)
        {
            HangarBlacklist selectedItem = (HangarBlacklist)AutoHangarBlacklist.SelectedItem;

            if (selectedItem != null)
            {
                Plugin.Config.AutoHangarPlayerBlacklist.Remove(selectedItem);
                Plugin.Config.RefreshModel();
            }
        }
Exemplo n.º 2
0
        private void AddNewBlacklistPlayer(object sender, RoutedEventArgs e)
        {
            //Update all public offer market items!
            if (!Hangar.IsRunning)
            {
                HangarBlacklist b = new HangarBlacklist();
                b.Name = AutoHangarNameBox.Text;

                Plugin.Config.AutoHangarPlayerBlacklist.Add(b);
            }
            else
            {
                //Server is running. We can attempt to get steamID
                HangarBlacklist b = new HangarBlacklist();
                b.Name = AutoHangarNameBox.Text;

                /*
                 * foreach(MyIdentity player in MySession.Static.Players.GetAllIdentities())
                 * {
                 *  Log.Info(player.DisplayName);
                 * }
                 */

                try
                {
                    MyIdentity player = MySession.Static.Players.GetAllIdentities().First(x => x.DisplayName.Equals(AutoHangarNameBox.Text));
                    b.SteamID = MySession.Static.Players.TryGetSteamId(player.IdentityId);
                }
                catch
                {
                    Log.Warn("Unable to find given character. Enter SteamID in manually");
                }
                Plugin.Config.AutoHangarPlayerBlacklist.Add(b);
            }
            AutoHangarNameBox.Text = "";
            Plugin.Config.RefreshModel();
        }