Skip to content

Commit 8054c14

Browse files
committed
Added missing config field warning.
1 parent 409b258 commit 8054c14

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

TLibrary/Models/Plugin/PluginBase.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,24 @@ public virtual void CheckPluginFiles()
192192
}
193193
}
194194

195+
// Log missing fields
196+
foreach (var field in Config.GetType().GetProperties())
197+
{
198+
if (field.GetValue(Config) != null)
199+
continue;
200+
201+
Logger.LogWarning($"The config field '{field.Name}' is missing in '{PluginName}' configuration.");
202+
}
203+
204+
foreach (var field in Config.GetType().GetFields())
205+
{
206+
if (field.GetValue(Config) != null)
207+
continue;
208+
209+
Logger.LogWarning($"The config field '{field.Name}' is missing in '{PluginName}' configuration.");
210+
}
211+
212+
195213
_logger.SetDebugMode(Config.DebugMode);
196214

197215
Dictionary<string, string> localLocalization = CommonLocalization ?? new Dictionary<string, string>();

0 commit comments

Comments
 (0)