mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Prevent spamming /team invite
This commit is contained in:
parent
f657da8021
commit
4886f693d1
@ -153,7 +153,16 @@ namespace MCGalaxy.Commands.Fun {
|
|||||||
Player.Message(p, "You need to provide the name of the person to invite."); return;
|
Player.Message(p, "You need to provide the name of the person to invite."); return;
|
||||||
}
|
}
|
||||||
Player who = PlayerInfo.FindMatches(p, args[1]);
|
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(p, "Invited " + who.ColoredName + " %Sto join your team.");
|
||||||
Player.Message(who, p.ColoredName + " %Sinvited you to join the " + team.Color + team.Name + " %Steam.");
|
Player.Message(who, p.ColoredName + " %Sinvited you to join the " + team.Color + team.Name + " %Steam.");
|
||||||
|
@ -83,7 +83,7 @@ namespace MCGalaxy {
|
|||||||
public string titlecolor = "";
|
public string titlecolor = "";
|
||||||
public int passtries = 0;
|
public int passtries = 0;
|
||||||
public bool hasreadrules;
|
public bool hasreadrules;
|
||||||
public DateTime NextReviewTime, NextEat;
|
public DateTime NextReviewTime, NextEat, NextTeamInvite;
|
||||||
public float ReachDistance = 5;
|
public float ReachDistance = 5;
|
||||||
public bool hackrank;
|
public bool hackrank;
|
||||||
public bool SuperUser;
|
public bool SuperUser;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user