diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-05-09 10:58:10 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-05-09 10:58:10 -0400 |
commit | 719831c15a74a4987496dc77a3caa6999940bf90 (patch) | |
tree | fc6c480136ee96ee47152928edc69de74a3e9370 | |
parent | d8d8cac2d89c27c6d28be444cebaabf0e2077a53 (diff) | |
download | SMAPI-719831c15a74a4987496dc77a3caa6999940bf90.tar.gz SMAPI-719831c15a74a4987496dc77a3caa6999940bf90.tar.bz2 SMAPI-719831c15a74a4987496dc77a3caa6999940bf90.zip |
sort mod warning lists
-rw-r--r-- | docs/release-notes.md | 3 | ||||
-rw-r--r-- | src/SMAPI/Framework/SCore.cs | 13 |
2 files changed, 8 insertions, 8 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index ee8bd468..f12455bd 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -2,6 +2,9 @@ # Release notes ## Upcoming released +* For players: + * Mod warnings are now listed alphabetically. + * For modders: * Added `Multiplayer.PeerConnected` event. * Simplified paranoid warnings in the log and reduced their log level. diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index 8c9424c1..cd292bfc 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -1205,10 +1205,12 @@ namespace StardewModdingAPI.Framework private void LogModWarningGroup(IModMetadata[] mods, Func<IModMetadata, bool> match, LogLevel level, string heading, string[] blurb, Func<IModMetadata, string> modLabel = null) { // get matching mods - IModMetadata[] matches = mods + string[] modLabels = mods .Where(match) + .Select(mod => modLabel?.Invoke(mod) ?? mod.DisplayName) + .OrderBy(p => p) .ToArray(); - if (!matches.Any()) + if (!modLabels.Any()) return; // log header/blurb @@ -1219,13 +1221,8 @@ namespace StardewModdingAPI.Framework this.Monitor.Newline(); // log mod list - foreach (IModMetadata modMatch in matches) - { - string label = modLabel != null - ? modLabel(modMatch) - : modMatch.DisplayName; + foreach (string label in modLabels) this.Monitor.Log($" - {label}", level); - } this.Monitor.Newline(); } |