From 29d498096d527daac9f031d72810048207e6930a Mon Sep 17 00:00:00 2001
From: Aleksander Waage <alek.ntnu@gmail.com>
Date: Fri, 20 Dec 2019 21:19:37 +0100
Subject: [PATCH] fixed verbose mode bug

---
 OWML.Common/ModBehaviour.cs                       | 13 -------------
 OWML.Launcher/App.cs                              |  2 +-
 OWML.ModLoader/Owo.cs                             | 15 ++++++++++++++-
 .../OWML.EnableDebugMode/manifest.json            |  2 +-
 OWML.SampleMods/OWML.TestMod/manifest.json        |  2 +-
 Readme.md                                         |  2 +-
 6 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/OWML.Common/ModBehaviour.cs b/OWML.Common/ModBehaviour.cs
index 9a28ef688..8bbc94e7a 100644
--- a/OWML.Common/ModBehaviour.cs
+++ b/OWML.Common/ModBehaviour.cs
@@ -10,19 +10,6 @@ public void Init(IModHelper modHelper)
         {
             ModHelper = modHelper;
             DontDestroyOnLoad(gameObject);
-            if (modHelper.Config.Verbose)
-            {
-                Application.logMessageReceived += OnLogMessageReceived;
-            }
-        }
-
-        private void OnLogMessageReceived(string message, string stackTrace, LogType type)
-        {
-            ModHelper.Logger.Log($"{type}: {message}");
-            if (type == LogType.Error || type == LogType.Exception)
-            {
-                ModHelper.Console.WriteLine($"{type}: {message}");
-            }
         }
 
     }
diff --git a/OWML.Launcher/App.cs b/OWML.Launcher/App.cs
index 4ae95d864..b11a3c6b7 100644
--- a/OWML.Launcher/App.cs
+++ b/OWML.Launcher/App.cs
@@ -11,7 +11,7 @@ namespace OWML.Launcher
 {
     public class App
     {
-        private const string OWMLVersion = "0.1.5";
+        private const string OWMLVersion = "0.1.6";
 
         private readonly string[] _filesToCopy = { "UnityEngine.CoreModule.dll", "Assembly-CSharp.dll" };
 
diff --git a/OWML.ModLoader/Owo.cs b/OWML.ModLoader/Owo.cs
index 142d437e2..8b28bcdcb 100644
--- a/OWML.ModLoader/Owo.cs
+++ b/OWML.ModLoader/Owo.cs
@@ -20,6 +20,10 @@ public Owo(IModHelper helper, IModFinder modFinder)
         public void LoadMods()
         {
             _helper.Logger.Log($"{nameof(Owo)}: {nameof(LoadMods)}");
+            if (_helper.Config.Verbose)
+            {
+                Application.logMessageReceived += OnLogMessageReceived;
+            }
             var manifests = _modFinder.GetManifests();
             foreach (var manifest in manifests)
             {
@@ -27,12 +31,21 @@ public void LoadMods()
             }
         }
 
+        private void OnLogMessageReceived(string message, string stackTrace, LogType type)
+        {
+            _helper.Logger.Log($"{type}: {message}");
+            if (type == LogType.Error || type == LogType.Exception)
+            {
+                _helper.Console.WriteLine($"{type}: {message}");
+            }
+        }
+
         private void LoadMod(IModManifest manifest)
         {
             var modType = LoadModType(manifest);
             if (modType == null)
             {
-                _helper.Logger.Log($"Mod type is null, skipping");
+                _helper.Logger.Log("Mod type is null, skipping");
                 return;
             }
             _helper.Logger.Log($"Loading {manifest.UniqueName} ({manifest.Version})...");
diff --git a/OWML.SampleMods/OWML.EnableDebugMode/manifest.json b/OWML.SampleMods/OWML.EnableDebugMode/manifest.json
index bfa2bb0bf..e98400a9c 100644
--- a/OWML.SampleMods/OWML.EnableDebugMode/manifest.json
+++ b/OWML.SampleMods/OWML.EnableDebugMode/manifest.json
@@ -4,6 +4,6 @@
   "name": "EnableDebugMode",
   "uniqueName": "Alek.EnableDebugMode",
   "version": "0.1",
-  "owmlVersion": "0.1.5",
+  "owmlVersion": "0.1.6",
   "enabled": true
 }
\ No newline at end of file
diff --git a/OWML.SampleMods/OWML.TestMod/manifest.json b/OWML.SampleMods/OWML.TestMod/manifest.json
index 1876784df..b372b536e 100644
--- a/OWML.SampleMods/OWML.TestMod/manifest.json
+++ b/OWML.SampleMods/OWML.TestMod/manifest.json
@@ -4,6 +4,6 @@
   "name": "TestMod",
   "uniqueName": "Alek.TestMod",
   "version": "0.1",
-  "owmlVersion": "0.1.5",
+  "owmlVersion": "0.1.6",
   "enabled": false
 }
\ No newline at end of file
diff --git a/Readme.md b/Readme.md
index a9a594f5e..d61ad96f1 100644
--- a/Readme.md
+++ b/Readme.md
@@ -138,7 +138,7 @@ Add a manifest file called manifest.json. Example:
   "name": "EnableDebugMode",
   "uniqueName": "Alek.EnableDebugMode",
   "version": "0.1",
-  "owmlVersion": "0.1.5",
+  "owmlVersion": "0.1.6",
   "enabled": true
 }
 ~~~~