diff --git a/TweakSystem/SubTweakManager.cs b/TweakSystem/SubTweakManager.cs index 91ae9ca9..4758e954 100644 --- a/TweakSystem/SubTweakManager.cs +++ b/TweakSystem/SubTweakManager.cs @@ -33,6 +33,11 @@ public override void Setup() { try { var tweak = (T) Activator.CreateInstance(t); if (tweak == null) continue; + if (SimpleTweaksPlugin.Plugin.GetTweakById(tweak.Key) != null) { + SimpleLog.Warning($"Skipped loading tweak with from '{t.Namespace}.{t.Name}'. Tweak with key '{tweak.Key}' already loaded."); + continue; + } + var blacklistKey = tweak.Key; if (tweak.Version > 1) blacklistKey += $"::{tweak.Version}"; if (PluginConfig.BlacklistedTweaks.Contains(blacklistKey)) { diff --git a/TweakSystem/TweakProvider.cs b/TweakSystem/TweakProvider.cs index 33970d22..fc3e21b3 100644 --- a/TweakSystem/TweakProvider.cs +++ b/TweakSystem/TweakProvider.cs @@ -23,6 +23,11 @@ public virtual void LoadTweaks() { SimpleLog.Debug($"Initalizing Tweak: {t.Name}"); try { var tweak = (BaseTweak) Activator.CreateInstance(t)!; + if (SimpleTweaksPlugin.Plugin.GetTweakById(tweak.Key) != null) { + SimpleLog.Warning($"Skipped loading tweak from class '{t.Namespace}.{t.Name}'. Tweak with key '{tweak.Key}' already loaded."); + continue; + } + tweak.InterfaceSetup(SimpleTweaksPlugin.Plugin, Service.PluginInterface, SimpleTweaksPlugin.Plugin.PluginConfig, this); if (tweak.CanLoad) { var blacklistKey = tweak.Key;