Example #1
0
        public InstallForm(UpdaterCore updaterCore)
        {
            InitializeComponent();
            headerLabel.ForeColor = Color.FromArgb(0, 51, 153);

            cancelButton.Text = updaterCore.Translation.Cancel;
            Text = updaterCore.Translation.ApplyUpdates;

            _updaterCore                 = updaterCore;
            _cancellationTokenSource     = new CancellationTokenSource();
            updaterCore.PropertyChanged += UpdaterCoreOnPropertyChanged;

            Task.Run(() => updaterCore.Update(_cancellationTokenSource.Token));
        }
        public override void LoadPlugin()
        {
            Logger.Log($"Loading ShimmysAdminTools v{UpdaterCore.CurrentVersion} by ShimmyMySherbet");
            base.LoadPlugin();
            Instance = this;
            Config   = Configuration.Instance;
            PlayerDataStore.Init();
            PlayerSessionStore.Init();
            U.Events.OnBeforePlayerConnected       += Events_OnBeforePlayerConnected;
            U.Events.OnPlayerConnected             += Events_OnPlayerConnected;
            U.Events.OnPlayerDisconnected          += Events_OnPlayerDisconnected;
            VehicleManager.onEnterVehicleRequested += VehicleManager_onEnterVehicleRequested;
            Rocket.Unturned.Events.UnturnedPlayerEvents.OnPlayerUpdateGesture += UnturnedPlayerEvents_OnPlayerUpdateGesture;

            ChatManager.onCheckPermissions += Chat_OnCheckPermissions;

            LoadCurrentPlayers();

            Level.onLevelLoaded += OnLevelloaded;


            Logger.Log("Checking for updates...");
            UpdaterCore.Init();

            if (UpdaterCore.IsOutDated)
            {
                Logger.LogWarning("ShimmysAdminTools is out of date!");
                Logger.Log($"Latest Version: v{UpdaterCore.LatestVersion}");
                if (UpdaterCore.TryGetUpdateMessage(out string msg))
                {
                    Logger.Log($"Update Notes:");
                    Logger.Log(msg);
                }
                Logger.Log("Download the latest update at https://github.com/ShimmyMySherbet/ShimmysAdminTools");
            }

            gameObject.AddComponent <RepeatCommandQueue>();

            if (!Config.DelayStartEXECUtility)
            {
                ExecManager.Activate();
            }
            Logger.Log("ShimmysAdminTools loaded.");
        }