Prevent spamming /team invite

This commit is contained in:
UnknownShadow200 2017-09-12 19:05:00 +10:00
parent f657da8021
commit 4886f693d1
2 changed files with 11 additions and 2 deletions

View File

@ -153,7 +153,16 @@ namespace MCGalaxy.Commands.Fun {
Player.Message(p, "You need to provide the name of the person to invite."); return;
}
Player who = PlayerInfo.FindMatches(p, args[1]);
if (who == null) return;
if (who == null) return;
DateTime cooldown = p.NextTeamInvite;
DateTime now = DateTime.UtcNow;
if (now < cooldown) {
Player.Message(p, "You can invite a player to join your team in another {0} seconds",
(int)(cooldown - now).TotalSeconds);
return;
}
p.NextTeamInvite = now.AddSeconds(5);
Player.Message(p, "Invited " + who.ColoredName + " %Sto join your team.");
Player.Message(who, p.ColoredName + " %Sinvited you to join the " + team.Color + team.Name + " %Steam.");

View File

@ -83,7 +83,7 @@ namespace MCGalaxy {
public string titlecolor = "";
public int passtries = 0;
public bool hasreadrules;
public DateTime NextReviewTime, NextEat;
public DateTime NextReviewTime, NextEat, NextTeamInvite;
public float ReachDistance = 5;
public bool hackrank;
public bool SuperUser;