protected override void Load() { Instance = this; ValidGroups = Configuration.Instance.Groups; foreach (DutyGroups Group in ValidGroups.ToList()) { RocketPermissionsGroup g = R.Permissions.GetGroup(Group.GroupID); if (g == null) { Logger.LogWarning("Permission group " + Group.GroupID + " does not exist! No command related to that group will execute."); ValidGroups.Remove(Group); } } Logger.LogWarning("Loading event \"Player Connected\"..."); U.Events.OnPlayerConnected += PlayerConnected; Logger.LogWarning("Loading event \"Player Disconnected\"..."); U.Events.OnPlayerDisconnected += PlayerDisconnected; Logger.LogWarning("Loading deathevents."); Rocket.Unturned.Events.UnturnedPlayerEvents.OnPlayerDeath += onplayerdeath; Logger.LogWarning(""); Logger.LogWarning("Duty has been successfully loaded!"); }
protected override void Unload() { Instance = null; Logger.LogWarning("Unloading on player connect event..."); U.Events.OnPlayerConnected -= PlayerConnected; Logger.LogWarning("Unloading on player disconnect event..."); U.Events.OnPlayerConnected -= PlayerDisconnected; Logger.LogWarning("Unloading deathevents."); Rocket.Unturned.Events.UnturnedPlayerEvents.OnPlayerDeath -= onplayerdeath; Logger.LogWarning(""); Logger.LogWarning("Duty has been unloaded!"); }