diff --git a/AdventureBackpacks/AdventureBackpacks.cs b/AdventureBackpacks/AdventureBackpacks.cs index 0900caf..a3789bb 100644 --- a/AdventureBackpacks/AdventureBackpacks.cs +++ b/AdventureBackpacks/AdventureBackpacks.cs @@ -34,7 +34,7 @@ public class AdventureBackpacks : BaseUnityPlugin, IPluginInfo //Module Constants private const string _pluginId = "vapok.mods.adventurebackpacks"; private const string _displayName = "AdventureBackpacks"; - private const string _version = "1.0.3"; + private const string _version = "1.0.4"; //Interface Properties public string PluginId => _pluginId; diff --git a/AdventureBackpacks/Properties/AssemblyInfo.cs b/AdventureBackpacks/Properties/AssemblyInfo.cs index d1e8c44..08ef562 100644 --- a/AdventureBackpacks/Properties/AssemblyInfo.cs +++ b/AdventureBackpacks/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.3.0")] -[assembly: AssemblyFileVersion("1.0.3.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.4.0")] +[assembly: AssemblyFileVersion("1.0.4.0")] \ No newline at end of file diff --git a/PATCHNOTES.md b/PATCHNOTES.md index b987946..eec7848 100644 --- a/PATCHNOTES.md +++ b/PATCHNOTES.md @@ -1,5 +1,8 @@ # Adventure Backpacks Patchnotes +# 1.0.4.0 + * Fixed a rare error on Piece Manager where on local play, if there is no adminlist file, it would error in the console. + * Fixed, In the event that there are multiple language files found for the same language, LocalizationManager would fail thus failing to load the mod. # 1.0.3.0 * Fixed Locking Server Config with Config Sync. Set 'Lock Config' to True in Server config (set while server is off) * Various Code Refactors and reorganization of methods. diff --git a/README.md b/README.md index 4e43cb7..f888084 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,9 @@ stage of maturity. This includes a backpack progression that will start at Meado * v2.0.0 - To be determined! # Current Patch Notes -# 1.0.3.0 -* Fixed Locking Server Config with Config Sync. Set 'Lock Config' to True in Server config (set while server is off) -* Various Code Refactors and reorganization of methods. -* Added Config to allow inventory and bag to be closed with the same hotkey. +## 1.0.4.0 +* Fixed a rare error on Piece Manager where on local play, if there is no adminlist file, it would error in the console. +* Fixed, In the event that there are multiple language files found for the same language, LocalizationManager would fail thus failing to load the mod. ## Compatible Mods (Verified) * Epic Loot 0.9.3+ diff --git a/Vapok.Common/Managers/LocalizationManager.cs b/Vapok.Common/Managers/LocalizationManager.cs index bd731bd..f130bf5 100644 --- a/Vapok.Common/Managers/LocalizationManager.cs +++ b/Vapok.Common/Managers/LocalizationManager.cs @@ -115,9 +115,26 @@ private static void LoadLocalization(Localization __instance, string language) { localizationObjects.Add(new WeakReference(__instance)); } + + localizationLanguage.Add(__instance, language); - Dictionary localizationFiles = Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath)!, $"{plugin.Info.Metadata.Name}.*", SearchOption.AllDirectories).Where(f => fileExtensions.IndexOf(Path.GetExtension(f)) >= 0).ToDictionary(f => Path.GetFileNameWithoutExtension(f).Split('.')[1], f => f); + Dictionary localizationFiles = new(); + + var languageFilesFound = Directory + .GetFiles(Path.GetDirectoryName(Paths.PluginPath)!, $"{plugin.Info.Metadata.Name}.*", + SearchOption.AllDirectories).Where(f => fileExtensions.IndexOf(Path.GetExtension(f)) >= 0); + + foreach (var languageFile in languageFilesFound) + { + var languageKey = Path.GetFileNameWithoutExtension(languageFile).Split('.')[1]; + if (localizationFiles.ContainsKey(languageKey)) + { + LogManager.Log.Warning($"{languageKey} has already been added. {languageFile} not added."); + continue; + } + localizationFiles.Add(languageKey, languageFile); + } if (LoadTranslationFromAssembly("English") is not { } englishAssemblyData) { diff --git a/Vapok.Common/Managers/PieceManager/PieceManager.cs b/Vapok.Common/Managers/PieceManager/PieceManager.cs index 57f37cf..0edc6cc 100644 --- a/Vapok.Common/Managers/PieceManager/PieceManager.cs +++ b/Vapok.Common/Managers/PieceManager/PieceManager.cs @@ -1004,7 +1004,7 @@ class RegisterClientRPCPatch { private static void Postfix(ZNet __instance, ZNetPeer peer) { - if (!__instance.IsServer()) + if (!__instance.IsServer() || __instance.m_adminList == null) { peer.m_rpc.Register(BuildPiece._plugin?.Info.Metadata.Name + " PMAdminStatusSync", RPC_InitialAdminSync); diff --git a/manifest.json b/manifest.json index 915ab11..570e12f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "AdventureBackpacks", - "version_number": "1.0.3", + "version_number": "1.0.4", "website_url": "https://github.com/Vapok/AdventureBackpacks", "description": "A Valheim Mod to add Adventuring Backpacks to the Game. These packs will grow and become more useful as the game progresses.", "dependencies": [