From 556aa97a81a557288d84964fdff5e7e600c6f8c7 Mon Sep 17 00:00:00 2001 From: Kr4ken-9 Date: Sat, 10 Jun 2017 01:54:38 -0500 Subject: [PATCH] Abuse Prevention + Cleanup --- CommandTPA.cs | 79 ++++++++++++--------------------------------------- PluginTPA.cs | 4 ++- 2 files changed, 21 insertions(+), 62 deletions(-) diff --git a/CommandTPA.cs b/CommandTPA.cs index 6c5e5af..1180ab3 100644 --- a/CommandTPA.cs +++ b/CommandTPA.cs @@ -18,72 +18,17 @@ public class CommandTPA : IRocketCommand private Dictionary coolDown = new Dictionary(); private Dictionary health = new Dictionary(); - public bool AllowFromConsole - { - get - { - return false; - } - } + public List Permissions => new List() { "CommandTPA.tpa" }; - public List Permissions - { - get - { - return new List() - { - "CommandTPA.tpa" - }; - } - } + public AllowedCaller AllowedCaller => AllowedCaller.Player; - public AllowedCaller AllowedCaller - { - get - { - return AllowedCaller.Player; - } - } + public string Name => "tpa"; - public bool RunFromConsole - { - get - { - return false; - } - } + public string Syntax => "tpa (player/accept/deny/ignore)"; - public string Name - { - get - { - return "tpa"; - } - } + public string Help => "Request a teleport to a player, accept or deny other requests."; - public string Syntax - { - get - { - return "tpa (player/accept/deny/ignore)"; - } - } - - public string Help - { - get - { - return "Request a teleport to a player, accept or deny other requests."; - } - } - - public List Aliases - { - get - { - return new List(); - } - } + public List Aliases => new List(); #endregion @@ -131,6 +76,12 @@ public void Execute(IRocketPlayer caller, string[] command) return; } + if(((UnturnedPlayer)caller).Stance == EPlayerStance.PRONE) + { + UnturnedChat.Say(caller, PluginTPA.Instance.Translate("prone")); + return; + } + if (PluginTPA.Instance.Configuration.Instance.TPADelay) { DelayTP(player, teleporter, PluginTPA.Instance.Configuration.Instance.TPADelaySeconds); @@ -218,6 +169,12 @@ public void Execute(IRocketPlayer caller, string[] command) return; } + if(requestTo.CSteamID.m_SteamID == ((UnturnedPlayer)caller).CSteamID.m_SteamID) + { + UnturnedChat.Say(caller, PluginTPA.Instance.Translate("abuse")); + return; + } + if (PluginTPA.Instance.Configuration.Instance.TPACoolDown) { if (coolDown.ContainsKey(player.CSteamID)) diff --git a/PluginTPA.cs b/PluginTPA.cs index a0994ad..36a965b 100644 --- a/PluginTPA.cs +++ b/PluginTPA.cs @@ -46,7 +46,9 @@ public override TranslationList DefaultTranslations { "request_pending", "You already have a request pending to this player." }, { "request_none", "You have no requests available!" }, { "request_abort", "You have aborted your TPA request." }, //New - { "translation_version_dont_edit", "3" } + { "translation_version_dont_edit", "3" }, + { "abuse", "You cannot teleport to yourself to prevent abuse." }, + { "prone", "You cannot accept teleports while proned to prevent abuse." } }; } }