Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of AutoDevcommands v1.0.0
AutoDevcommands.dll
Decompiled 2 days agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("AutoDevcommands")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AutoDevcommands")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e6348967-70a4-4b8f-a6b2-b79343ef2ee5")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("sbo.autodevcommands", "AutoDevcommands", "1.0.0")] [BepInProcess("valheim.exe")] public class AutoDevcommandsPlugin : BaseUnityPlugin { public static ConfigEntry<bool> configDebugMode; public static ConfigEntry<bool> configGod; public static ManualLogSource Log; private static bool hasRunDevCommands; private static bool hasExecutedWorldCommands; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; configDebugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "debugmode", true, "Automatically enter the debugmode command when entering the world"); configGod = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "god", true, "Automatically enter the god command when entering the world"); Harmony.CreateAndPatchAll(typeof(AutoDevcommandsPlugin), (string)null); Log.LogInfo((object)"AutoDevcommands plugin loaded successfully."); } [HarmonyPatch(typeof(Console), "Awake")] [HarmonyPostfix] private static void ConsoleAwakePostfix() { if (!hasRunDevCommands && (Object)(object)Console.instance != (Object)null) { hasRunDevCommands = true; ((Terminal)Console.instance).TryRunCommand("devcommands", false, false); Log.LogInfo((object)"AutoDevcommands: devcommands executed at main menu."); } } [HarmonyPatch(typeof(Game), "Start")] [HarmonyPostfix] private static void GameStartPostfix() { hasExecutedWorldCommands = false; } [HarmonyPatch(typeof(Player), "Update")] [HarmonyPostfix] private static void PlayerUpdatePostfix(Player __instance) { if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && !hasExecutedWorldCommands && (Object)(object)Console.instance != (Object)null) { hasExecutedWorldCommands = true; if (configDebugMode.Value) { ((Terminal)Console.instance).TryRunCommand("debugmode", false, false); Log.LogInfo((object)"AutoDevcommands: debugmode executed."); } if (configGod.Value) { ((Terminal)Console.instance).TryRunCommand("god", false, false); Log.LogInfo((object)"AutoDevcommands: god executed."); } } } }