public override void Init(ITorchBase torch) { base.Init(torch); // Set static instance. Instance = this; Log.Info("Loading Torch Economy..."); // Load up the configuration string path = Path.Combine(StoragePath, "Economy.cfg"); Log.Info($"Attempting to load config from {path}"); _config = Persistent <EconomyConfig> .Load(path); // Build the SQLite dependencies. SQLiteInstaller.CheckSQLiteInstalled(); // Associate Torch containers for lifetime management. _sessionManager = Torch.Managers.GetManager(typeof(TorchSessionManager)) as TorchSessionManager; if (_sessionManager != null) { _sessionManager.SessionStateChanged += SessionChanged; // Add mod override for the economy client mod for client enhancements. _sessionManager.AddOverrideMod(1772298664); // var instanceManager = Torch // .Managers // .GetManager<InstanceManager>(); // // instanceManager. // .DedicatedConfig.Mods.Add(new ModItemInfo(new MyObjectBuilder_Checkpoint.ModItem(1772298664))); } else { Log.Warn("No session manager. Economy system won't work."); } GetConnectionFactory().Setup(); DefinitionResolver = GetContainer().GetInstance <DefinitionResolver>(); Torch.GameStateChanged += OnGameStateChanged; Log.Info("Torch Economy Initialized!"); }
protected T GetManager <T>() where T : BaseManager { return(EconomyPlugin.GetManager <T>()); }
protected TProvider GetDataProvider <TProvider>() where TProvider : class, IDataProvider { return(EconomyPlugin.GetDataProvider <TProvider>()); }
public EconomyControl(EconomyPlugin plugin) : this() { Plugin = plugin; DataContext = plugin.Config; }