summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/release-notes.md1
-rw-r--r--src/SMAPI/Framework/IModMetadata.cs3
-rw-r--r--src/SMAPI/Framework/ModLoading/ModMetadata.cs9
-rw-r--r--src/SMAPI/Program.cs8
4 files changed, 21 insertions, 0 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index e524ea65..cde7847e 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -10,6 +10,7 @@
* For modders:
* Added code analysis to mod build config package to flag common issues as warnings.
+ * Added warning when a mod doesn't have update keys (currently only shown in developer mode).
* Dropped some deprecated APIs.
* Fixed assets loaded by temporary content managers not being editable.
* Fixed issue where assets didn't reload correctly when the player switches language.
diff --git a/src/SMAPI/Framework/IModMetadata.cs b/src/SMAPI/Framework/IModMetadata.cs
index d1e8eb7d..248809df 100644
--- a/src/SMAPI/Framework/IModMetadata.cs
+++ b/src/SMAPI/Framework/IModMetadata.cs
@@ -64,5 +64,8 @@ namespace StardewModdingAPI.Framework
/// <summary>Set the mod-provided API instance.</summary>
/// <param name="api">The mod-provided API.</param>
IModMetadata SetApi(object api);
+
+ /// <summary>Whether the mod has at least one update key set.</summary>
+ bool HasUpdateKeys();
}
}
diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
index 1a0f9994..af888b71 100644
--- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs
+++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using StardewModdingAPI.Framework.ModData;
namespace StardewModdingAPI.Framework.ModLoading
@@ -102,5 +103,13 @@ namespace StardewModdingAPI.Framework.ModLoading
this.Api = api;
return this;
}
+
+ /// <summary>Whether the mod has at least one update key set.</summary>
+ public bool HasUpdateKeys()
+ {
+ return
+ this.Manifest?.UpdateKeys != null
+ && this.Manifest.UpdateKeys.Any(key => !string.IsNullOrWhiteSpace(key));
+ }
}
}
diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs
index f70efb89..cf1c082a 100644
--- a/src/SMAPI/Program.cs
+++ b/src/SMAPI/Program.cs
@@ -722,6 +722,10 @@ namespace StardewModdingAPI
continue;
}
+ // show warnings
+ if (this.Settings.DeveloperMode && !metadata.HasUpdateKeys())
+ this.Monitor.Log($" {metadata.DisplayName} has no {nameof(IManifest.UpdateKeys)} in its manifest. You may not see update alerts for this mod.", LogLevel.Warn);
+
// load mod as content pack
IMonitor monitor = this.GetSecondaryMonitor(metadata.DisplayName);
ContentManagerShim contentManager = this.ContentCore.CreateContentManager($"Mods.{metadata.Manifest.UniqueID}", metadata.DirectoryPath);
@@ -766,6 +770,10 @@ namespace StardewModdingAPI
continue;
}
+ // show warnings
+ if (this.Settings.DeveloperMode && !metadata.HasUpdateKeys() && metadata.Manifest.UniqueID != "SMAPI.ConsoleCommands")
+ this.Monitor.Log($" {metadata.DisplayName} has no {nameof(IManifest.UpdateKeys)} in its manifest. You may not see update alerts for this mod.", LogLevel.Warn);
+
// load mod
string assemblyPath = metadata.Manifest?.EntryDll != null
? Path.Combine(metadata.DirectoryPath, metadata.Manifest.EntryDll)