diff --git a/src/AltCmd.cs b/src/AltCmd.cs index 1be7f28..5340882 100644 --- a/src/AltCmd.cs +++ b/src/AltCmd.cs @@ -73,9 +73,9 @@ private bool HandleCommandCatched(Func orig, T return orig(player, text); } - private static MethodInfo _uncatchedHandleCommand = Utils.Method(() => + private static readonly MethodInfo _uncatchedHandleCommand = Utils.Method(() => new Plugin(null!).HandleCommandUncatched(null!, null!, null!))!; - private static MethodInfo _catchedHandleCommand = Utils.Method(() => + private static readonly MethodInfo _catchedHandleCommand = Utils.Method(() => new Plugin(null!).HandleCommandCatched(null!, null!, null!))!; private bool Detour_Command_Run(Func, bool> orig, Command instance, string msg, bool silent, TSPlayer ply, List parms) diff --git a/src/Backport.cs b/src/Backport.cs index 51aa510..8a7a9fe 100644 --- a/src/Backport.cs +++ b/src/Backport.cs @@ -38,7 +38,7 @@ public void Run() } #endregion -private void Detour_Backport_2934(Action orig) + private void Detour_Backport_2934(Action orig) { orig(); if (!Terraria.Netplay.HasClients) diff --git a/src/Config.cs b/src/Config.cs index 7fa3964..bf06dcb 100644 --- a/src/Config.cs +++ b/src/Config.cs @@ -99,6 +99,12 @@ public class EnhancementsSettings /// public Optional SyncVersion = Optional.Default(false); + /// + /// Fix the broken default language detect. + /// + /// + public Optional DefaultLanguageDetect = Optional.Default(true); + /// /// Action for TShock's update /// @@ -672,4 +678,4 @@ public Optional(T value) } public static implicit operator T(Optional self) => self.Value; -} +} \ No newline at end of file diff --git a/src/Plugin.cs b/src/Plugin.cs index 9474890..50df183 100644 --- a/src/Plugin.cs +++ b/src/Plugin.cs @@ -94,6 +94,11 @@ public Plugin(Main game) : base(game) typeof(Rests.Rest) .GetMethod("OnRequest", _bfany)!, this.ILHook_Mitigation_KeepRestAlive); + + if (this.config.Enhancements.Value.DefaultLanguageDetect) + { + typeof(System.Globalization.CultureInfo).GetField("s_currentThreadUICulture", _bfany)?.SetValue(null, null); + } } private void LoadConfig(TSPlayer? initiator)