Пример #1
0
        /// <inheritdoc />
        public override void Init(ITorchBase torch)
        {
            base.Init(torch);
            string path = Path.Combine(StoragePath, "Essentials.cfg");

            Log.Info($"Attempting to load config from {path}");
            _config = Persistent <EssentialsConfig> .Load(path);

            _knownIds = new KnownIdsStorage(Path.Combine(StoragePath, "Essentials.KnownSteamIds.txt"));
            _knownIds.Read();
            _sessionManager = Torch.Managers.GetManager <TorchSessionManager>();
            if (_sessionManager != null)
            {
                _sessionManager.SessionStateChanged += SessionChanged;
            }
            else
            {
                Log.Warn("No session manager.  MOTD won't work");
            }
            homeDataPath = Path.Combine(StoragePath, "players.json");
            if (!File.Exists(homeDataPath))
            {
                File.Create(homeDataPath);
            }



            rankDataPath = Path.Combine(StoragePath, "ranks.json");
            if (!File.Exists(rankDataPath))
            {
                File.Create(rankDataPath);
            }



            Instance = this;
            _pm      = torch.Managers.GetManager <PatchManager>();
            _context = _pm.AcquireContext();
            SessionDownloadPatch.Patch(_context);

            if (Config.CutGameTags)
            {
                GameTagsPatch.Patch(_context);
            }
        }
Пример #2
0
        /// <inheritdoc />
        public override void Init(ITorchBase torch)
        {
            base.Init(torch);
            string path = Path.Combine(StoragePath, "Essentials.cfg");

            Log.Info($"Attempting to load config from {path}");
            _config = Persistent <EssentialsConfig> .Load(path);

            _sessionManager = Torch.Managers.GetManager <TorchSessionManager>();
            if (_sessionManager != null)
            {
                _sessionManager.SessionStateChanged += SessionChanged;
            }
            else
            {
                Log.Warn("No session manager.  MOTD won't work");
            }

            Instance = this;
            _pm      = torch.Managers.GetManager <PatchManager>();
            _context = _pm.AcquireContext();
            SessionDownloadPatch.Patch(_context);
        }