private static void Load() { if (!_isInitialized || !_isServer) { return; } _configFile = new ProtectionConfigFile(Path.GetFileNameWithoutExtension(MyAPIGateway.Session.CurrentPath)); Config = _configFile.Config; }
public static void Init() { if (_isInitialized) return; _isInitialized = true; Config = new ProtectionConfig(); Load(); _handtoolCache = new HandtoolCache(); MyAPIGateway.Session.DamageSystem.RegisterBeforeDamageHandler(0, DamageHandler); }
public static void InitOrUpdateClient(ProtectionConfig config) { // still allow update of cfg Config = config; if (_isInitialized) { return; } // but no init, as for servers we won't init it anyway _isInitialized = true; ChatCommandLogic.Instance.AllowBuilding = true; MyAPIGateway.Session.DamageSystem.RegisterBeforeDamageHandler(0, DamageHandler_Client); }
public static void Init_Server() { if (_isInitialized) { return; } _isInitialized = true; _isServer = true; Config = new ProtectionConfig(); Load(); _sentFailedMessage = new Dictionary <IMyPlayer, DateTime>(); // every 30 seconds _cleanupTimer = new ThreadsafeTimer(30000); _cleanupTimer.Elapsed += CleanUp; _cleanupTimer.Start(); MyAPIGateway.Session.DamageSystem.RegisterBeforeDamageHandler(0, DamageHandler_Server); ChatCommandLogic.Instance.AllowBuilding = true; }
public override void ProcessServer() { Config = ProtectionHandler.Config; ConnectionHelper.SendMessageToPlayer(SenderSteamId, this); }