From 0c1bca3db044b6f228538f1738d52c31e4481e48 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 17 Feb 2018 18:51:09 -0500 Subject: validate that mod APIs are public (#435) --- src/SMAPI/Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/SMAPI') diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 88e27768..fd2bb340 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -804,6 +804,12 @@ namespace StardewModdingAPI try { object api = metadata.Mod.GetApi(); + if (api != null && !api.GetType().IsPublic) + { + api = null; + this.Monitor.Log($"{metadata.DisplayName} provides an API instance with a non-public type. This isn't currently supported, so the API won't be available to other mods.", LogLevel.Warn); + } + if (api != null) this.Monitor.Log($" Found mod-provided API ({api.GetType().FullName}).", LogLevel.Trace); metadata.SetApi(api); -- cgit