private void UnregisterEvents() { CustomConfigs.Clear(); /* <- clear the list of configs */ Qurre.Events.Round.Waiting -= EventHandlers.WaitingForPlayers; /* <- method unregister */ Qurre.Events.Player.Join -= EventHandlers.PlayerJoin; /* <- method unregister */ EventHandlers = null; /* <- deleting a class with events */ }
public override void Disable() { ServerEvent.Start -= handler.OnRoundStart; CustomConfigs.Remove(CustomConfig); handler = null; Singleton = null; }
} /* <- creating a new config class */ #endregion #region RegEvents /* registration of events(you can use any name) */ private void RegisterEvents() { CustomConfig = new Config(); CustomConfigs.Add(CustomConfig); /* <- Add and initialize the configuration */ EventHandlers = new EventHandlers(this); /* <- class declaration with events */ Qurre.Events.Round.Waiting += EventHandlers.WaitingForPlayers; /* <- method register */ Qurre.Events.Player.Join += EventHandlers.PlayerJoin; /* <- method register */ }
public override void Enable() { CustomConfigs.Add(CustomConfig); if (!CustomConfig.IsEnabled) { return; } Singleton = this; handler = new Handler(CustomConfig); ServerEvent.Start += handler.OnRoundStart; }