bool isAllowed(ICommandSender sender) { //Checking if the ICommandSender is a player and setting the player variable if it is Player player = (sender is Player) ? sender as Player : null; //Checks if its a player, if not run the command as usual if (player != null) { //Making a list of all roles in config, converted to UPPERCASE string[] configList = plugin.GetConfigList(SCP939.ranksAllowedConfigKey); List <string> roleList = (configList != null && configList.Length > 0) ? configList.Select(role => role.ToUpper()).ToList() : new List <string>(); //Checks if there is any entries, if empty, let anyone use it if (roleList != null && roleList.Count > 0 && (roleList.Contains(player.GetUserGroup().Name.ToUpper()) || roleList.Contains(player.GetRankName().ToUpper()))) { //Config contained rank return(true); } else if (roleList == null || roleList.Count == 0 || (roleList.Count == 1 && string.IsNullOrEmpty(roleList.First()))) { return(true); // config was empty } else { return(false); // config was not empty and didnt contain player role } } else { return(true); // if command is run by server window } }