summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/SCore.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-10-08 19:59:21 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-10-08 19:59:21 -0400
commita565ac9405a95d24f7cf945228935107e91bb89f (patch)
treebd5a159eb559ba0fdfc647bed32d6708ea6ef61d /src/SMAPI/Framework/SCore.cs
parente8da8fff5163eacd6ae7870eaa8c7dbc8285e3e7 (diff)
downloadSMAPI-a565ac9405a95d24f7cf945228935107e91bb89f.tar.gz
SMAPI-a565ac9405a95d24f7cf945228935107e91bb89f.tar.bz2
SMAPI-a565ac9405a95d24f7cf945228935107e91bb89f.zip
make GetApi methods mutually exclusive & improve docs
Diffstat (limited to 'src/SMAPI/Framework/SCore.cs')
-rw-r--r--src/SMAPI/Framework/SCore.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index 16ff2537..4ba0dd9c 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -1779,6 +1779,11 @@ namespace StardewModdingAPI.Framework
{
this.Monitor.Log($"Failed loading mod-provided API for {metadata.DisplayName}. Integrations with other mods may not work. Error: {ex.GetLogSummary()}", LogLevel.Error);
}
+
+ // validate mod doesn't implement both GetApi() and GetApi(mod)
+ if (metadata.Api != null && metadata.Mod!.GetType().GetMethod(nameof(Mod.GetApi), new Type[] { typeof(IManifest) })!.DeclaringType != typeof(Mod))
+ metadata.LogAsMod($"Mod implements both {nameof(Mod.GetApi)}() and {nameof(Mod.GetApi)}({nameof(IManifest)}), which isn't allowed. The latter will be ignored.", LogLevel.Error);
+
Context.HeuristicModsRunningCode.TryPop(out _);
}