Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abuse Prevention + Cleanup #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 18 additions & 61 deletions CommandTPA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,72 +18,17 @@ public class CommandTPA : IRocketCommand
private Dictionary<CSteamID, DateTime> coolDown = new Dictionary<CSteamID, DateTime>();
private Dictionary<CSteamID, byte> health = new Dictionary<CSteamID, byte>();

public bool AllowFromConsole
{
get
{
return false;
}
}
public List<string> Permissions => new List<String>() { "CommandTPA.tpa" };

public List<string> Permissions
{
get
{
return new List<string>()
{
"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<string> Aliases
{
get
{
return new List<string>();
}
}
public List<string> Aliases => new List<string>();

#endregion

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 3 additions & 1 deletion PluginTPA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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." }
};
}
}
Expand Down