From b9c5e2648db08c36e673d8fb5ef1024e57e96b30 Mon Sep 17 00:00:00 2001 From: Antoniofo Date: Tue, 2 Aug 2022 10:38:14 +0200 Subject: [PATCH 1/3] change NickName to UserID and country empty instead of null --- .idea/.idea.VT-Api/.idea/.gitignore | 13 +++++++++++++ .idea/.idea.VT-Api/.idea/encodings.xml | 4 ++++ .idea/.idea.VT-Api/.idea/indexLayout.xml | 8 ++++++++ .idea/.idea.VT-Api/.idea/vcs.xml | 6 ++++++ VT-Api/Core/Translation/TranslationManager.cs | 12 ++++++------ 5 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 .idea/.idea.VT-Api/.idea/.gitignore create mode 100644 .idea/.idea.VT-Api/.idea/encodings.xml create mode 100644 .idea/.idea.VT-Api/.idea/indexLayout.xml create mode 100644 .idea/.idea.VT-Api/.idea/vcs.xml diff --git a/.idea/.idea.VT-Api/.idea/.gitignore b/.idea/.idea.VT-Api/.idea/.gitignore new file mode 100644 index 0000000..19756cd --- /dev/null +++ b/.idea/.idea.VT-Api/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/.idea.VT-Api.iml +/projectSettingsUpdater.xml +/modules.xml +/contentModel.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.VT-Api/.idea/encodings.xml b/.idea/.idea.VT-Api/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.VT-Api/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.VT-Api/.idea/indexLayout.xml b/.idea/.idea.VT-Api/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.VT-Api/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.VT-Api/.idea/vcs.xml b/.idea/.idea.VT-Api/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.VT-Api/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/VT-Api/Core/Translation/TranslationManager.cs b/VT-Api/Core/Translation/TranslationManager.cs index b2f6aa0..81dda7e 100644 --- a/VT-Api/Core/Translation/TranslationManager.cs +++ b/VT-Api/Core/Translation/TranslationManager.cs @@ -68,7 +68,7 @@ public string GetUserCountry(Player player) } catch (Exception) { - ipInfo.Country = null; + ipInfo.Country = ""; } return ipInfo.Country; @@ -86,7 +86,7 @@ public string GetUserCountry(string ip) } catch (Exception) { - ipInfo.Country = null; + ipInfo.Country = ""; } return ipInfo.Country; @@ -102,7 +102,7 @@ public string GetLanguage(Player player) public TPluginTranslation GetTranslation(SynapseTranslation translation, Player player) where TPluginTranslation : IPluginTranslation { - if (!PlayersLanguage.TryGetValue(player.NickName, out var language)) + if (!PlayersLanguage.TryGetValue(player.UserId, out var language)) { Logger.Get.Error($"The player language of {player.NickName} is not set !"); return translation.ActiveTranslation; @@ -114,7 +114,7 @@ public TPluginTranslation GetTranslation(SynapseTranslation< #region Events private void OnJoin(PlayerJoinEventArgs ev) { - if (PlayersLanguage.ContainsKey(ev.Player.NickName)) + if (PlayersLanguage.ContainsKey(ev.Player.UserId)) return; var language = ev.Player.GetData("Language"); if (language == null) @@ -122,14 +122,14 @@ private void OnJoin(PlayerJoinEventArgs ev) language = GetLanguage(ev.Player).ToUpper(); ev.Player.SetData("Language", language); } - PlayersLanguage.Add(ev.Player.NickName, language); + PlayersLanguage.Add(ev.Player.UserId, language); } private void OnRoundRestart() { foreach(var playerLanguage in PlayersLanguage) { - if (!Server.Get.Players.Any(p => p.NickName == playerLanguage.Key)) + if (!Server.Get.Players.Any(p => p.UserId == playerLanguage.Key)) PlayersLanguage.Remove(playerLanguage.Key); } } From 5c5277f3782295670384a17c67170085c903bf0a Mon Sep 17 00:00:00 2001 From: Sanctur Date: Fri, 28 Oct 2022 16:52:21 +0200 Subject: [PATCH 2/3] Update package --- Exemple-Plugin/Exemple-Plugin.csproj | 16 ++++++++-------- Exemple-Plugin/packages.config | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Exemple-Plugin/Exemple-Plugin.csproj b/Exemple-Plugin/Exemple-Plugin.csproj index 9e4765b..ba70a02 100644 --- a/Exemple-Plugin/Exemple-Plugin.csproj +++ b/Exemple-Plugin/Exemple-Plugin.csproj @@ -35,19 +35,19 @@ ..\packages\Lib.Harmony.2.2.1\lib\net48\0Harmony.dll - ..\packages\SynapseSL.2.10.0\lib\net472\Assembly-CSharp.dll + ..\packages\SynapseSL.2.10.1\lib\net472\Assembly-CSharp.dll - ..\packages\SynapseSL.2.10.0\lib\net472\Assembly-CSharp-firstpass.dll + ..\packages\SynapseSL.2.10.1\lib\net472\Assembly-CSharp-firstpass.dll ..\packages\LiteDB.5.0.11\lib\net45\LiteDB.dll - ..\packages\SynapseSL.2.10.0\lib\net472\Mirror.dll + ..\packages\SynapseSL.2.10.1\lib\net472\Mirror.dll - - ..\packages\SynapseSL.2.10.0\lib\net472\Synapse.dll + + ..\packages\SynapseSL.2.10.1\lib\net472\Synapse.dll @@ -59,13 +59,13 @@ - ..\packages\SynapseSL.2.10.0\lib\net472\UnityEngine.dll + ..\packages\SynapseSL.2.10.1\lib\net472\UnityEngine.dll - ..\packages\SynapseSL.2.10.0\lib\net472\UnityEngine.CoreModule.dll + ..\packages\SynapseSL.2.10.1\lib\net472\UnityEngine.CoreModule.dll - ..\packages\SynapseSL.2.10.0\lib\net472\UnityEngine.PhysicsModule.dll + ..\packages\SynapseSL.2.10.1\lib\net472\UnityEngine.PhysicsModule.dll ..\packages\YamlDotNet.11.2.1\lib\net45\YamlDotNet.dll diff --git a/Exemple-Plugin/packages.config b/Exemple-Plugin/packages.config index 27c73f5..c254a85 100644 --- a/Exemple-Plugin/packages.config +++ b/Exemple-Plugin/packages.config @@ -2,6 +2,6 @@ - + \ No newline at end of file From d68e724c2a21a69f18801cfce510dcabc1e2cdef Mon Sep 17 00:00:00 2001 From: Sanctur Date: Fri, 28 Oct 2022 16:52:44 +0200 Subject: [PATCH 3/3] update package --- VT-Api/VT-Api.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VT-Api/VT-Api.csproj b/VT-Api/VT-Api.csproj index 5ad4013..ea93152 100644 --- a/VT-Api/VT-Api.csproj +++ b/VT-Api/VT-Api.csproj @@ -208,7 +208,7 @@ 13.0.1 - 2.10.0 + 2.10.1