Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
Merge branch 'devlopement' of https://github.com/VT-DevGiT/VT-Api int…
Browse files Browse the repository at this point in the history
…o devlopement
  • Loading branch information
warquys committed Dec 14, 2022
2 parents 11d105d + ec805c3 commit 7033633
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 16 deletions.
13 changes: 13 additions & 0 deletions .idea/.idea.VT-Api/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.VT-Api/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.VT-Api/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.VT-Api/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Exemple-Plugin/Exemple-Plugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@
<HintPath>..\packages\Lib.Harmony.2.2.1\lib\net48\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\Assembly-CSharp.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.1\lib\net472\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\Assembly-CSharp-firstpass.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.1\lib\net472\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="LiteDB, Version=5.0.11.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.11\lib\net45\LiteDB.dll</HintPath>
</Reference>
<Reference Include="Mirror, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\Mirror.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.1\lib\net472\Mirror.dll</HintPath>
</Reference>
<Reference Include="Synapse, Version=2.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\Synapse.dll</HintPath>
<Reference Include="Synapse, Version=2.10.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.10.1\lib\net472\Synapse.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -59,13 +59,13 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\UnityEngine.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.1\lib\net472\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\UnityEngine.CoreModule.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.1\lib\net472\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SynapseSL.2.10.0\lib\net472\UnityEngine.PhysicsModule.dll</HintPath>
<HintPath>..\packages\SynapseSL.2.10.1\lib\net472\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
<Reference Include="YamlDotNet, Version=11.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.11.2.1\lib\net45\YamlDotNet.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion Exemple-Plugin/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<packages>
<package id="Lib.Harmony" version="2.2.1" targetFramework="net48" />
<package id="LiteDB" version="5.0.11" targetFramework="net48" />
<package id="SynapseSL" version="2.10.0" targetFramework="net48" />
<package id="SynapseSL" version="2.10.1" targetFramework="net48" />
<package id="YamlDotNet" version="11.2.1" targetFramework="net48" />
</packages>
12 changes: 6 additions & 6 deletions VT-Api/Core/Translation/TranslationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public string GetUserCountry(Player player)
}
catch (Exception)
{
ipInfo.Country = null;
ipInfo.Country = "";
}

return ipInfo.Country;
Expand All @@ -86,7 +86,7 @@ public string GetUserCountry(string ip)
}
catch (Exception)
{
ipInfo.Country = null;
ipInfo.Country = "";
}

return ipInfo.Country;
Expand All @@ -102,7 +102,7 @@ public string GetLanguage(Player player)

public TPluginTranslation GetTranslation<TPluginTranslation>(SynapseTranslation<TPluginTranslation> 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;
Expand All @@ -114,22 +114,22 @@ public TPluginTranslation GetTranslation<TPluginTranslation>(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)
{
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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion VT-Api/VT-Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
<Version>13.0.1</Version>
</PackageReference>
<PackageReference Include="SynapseSL">
<Version>2.10.0</Version>
<Version>2.10.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down

0 comments on commit 7033633

Please sign in to comment.