Skip to content

Commit

Permalink
Update translation and delete unuse code
Browse files Browse the repository at this point in the history
  • Loading branch information
尧杰 曾 committed Aug 4, 2022
1 parent 2f4d509 commit f6cee49
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 29 deletions.
33 changes: 7 additions & 26 deletions PermissionSync/Command/PermissionSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public void Execute(IRocketPlayer caller, string[] args)
{
var player = UnturnedPlayer.FromCSteamID(new Steamworks.CSteamID(result));
Main.Instance.databese.AddPermission((caller.Id),player, args[2]);
UnturnedChat.Say(caller, Main.Instance.Translate("add_permission"));
UnturnedChat.Say(caller, Main.Instance.Translate("add_permission", args[2],player.DisplayName));
}
else
{
var player = UnturnedPlayer.FromName(args[1]);
if (player != null)
{
Main.Instance.databese.AddPermission(caller.Id, player, args[2]);
UnturnedChat.Say(caller, Main.Instance.Translate("add_permission"));
UnturnedChat.Say(caller, Main.Instance.Translate("add_permission", args[2],player.DisplayName));
}
else
{
Expand All @@ -57,15 +57,15 @@ public void Execute(IRocketPlayer caller, string[] args)
{
var player = UnturnedPlayer.FromCSteamID(new Steamworks.CSteamID(result));
Main.Instance.databese.RemovePermission(player, args[2]);
UnturnedChat.Say(caller, Main.Instance.Translate("remove_permission"));
UnturnedChat.Say(caller, Main.Instance.Translate("remove_permission", args[2],player.DisplayName));
}
else
{
var player = UnturnedPlayer.FromName(args[1]);
if (player != null)
{
Main.Instance.databese.RemovePermission(player, args[2]);
UnturnedChat.Say(caller, Main.Instance.Translate("remove_permission"));
UnturnedChat.Say(caller, Main.Instance.Translate("remove_permission", args[2],player.DisplayName));
}
else
{
Expand All @@ -82,34 +82,15 @@ public void Execute(IRocketPlayer caller, string[] args)
{
var player = UnturnedPlayer.FromCSteamID(new Steamworks.CSteamID(result));
Main.Instance.databese.AddPermission(caller.Id,player, args[2], args[3]);
UnturnedChat.Say(caller, Main.Instance.Translate("add_permission"));
UnturnedChat.Say(caller, Main.Instance.Translate("add_permission", args[2],player.DisplayName));
}
else
{
var player = UnturnedPlayer.FromName(args[1]);
if (player != null)
{
Main.Instance.databese.AddPermission(caller.Id, player, args[2], args[3]);
}
else
{
UnturnedChat.Say(caller, Main.Instance.Translate("player_not_found"), UnityEngine.Color.red);
}
}
}
if (args[0] == "remove")
{
if (ulong.TryParse(args[1], out ulong result))
{
var player = UnturnedPlayer.FromCSteamID(new Steamworks.CSteamID(result));
Main.Instance.databese.RemovePermission(player, args[2]);
}
else
{
var player = UnturnedPlayer.FromName(args[1]);
if (player != null)
{
Main.Instance.databese.RemovePermission(player, args[2]);
UnturnedChat.Say(caller, Main.Instance.Translate("add_permission", args[2], player.DisplayName));
}
else
{
Expand All @@ -121,7 +102,7 @@ public void Execute(IRocketPlayer caller, string[] args)
}
else
{
UnturnedChat.Say(caller, Main.Instance.Translate(""), UnityEngine.Color.red);
UnturnedChat.Say(caller, Main.Instance.Translate("wrong_usage",Syntax), UnityEngine.Color.red);
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion PermissionSync/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ protected override void Unload()
public override TranslationList DefaultTranslations => new TranslationList
{
{"player_not_found","Player not found!" },
{"permission_expired","your permission group has been expired:{0}" }
{"permission_expired","your permission group has been expired:{0}." },
{"sync_permission","Your permission group has been synced." },
{"add_permission","Permission group:{0} has been added to {1}" },
{"remove_permission","Successfully removed permission group:{0} from {1}" },
{"wrong_usage","wrong usage.Usage:{0}." }
};
}
}
4 changes: 2 additions & 2 deletions PermissionSync/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyVersion("1.0.1.1")]
[assembly: AssemblyFileVersion("1.0.1.1")]

0 comments on commit f6cee49

Please sign in to comment.