diff --git a/MCGalaxy/Commands/Moderation/CmdPatrol.cs b/MCGalaxy/Commands/Moderation/CmdPatrol.cs index 778e3255c..1eef85ca5 100644 --- a/MCGalaxy/Commands/Moderation/CmdPatrol.cs +++ b/MCGalaxy/Commands/Moderation/CmdPatrol.cs @@ -36,12 +36,10 @@ namespace MCGalaxy.Commands.Moderation { List candidates = GetPatrolCandidates(p); if (candidates.Count == 0) { - LevelPermission perm = CommandExtraPerms.MinPerm(name); - Player.Message(p, "No {0}players ranked {1} %Sor below are online.", - p.Rank <= perm ? "other " : "", // in case we can patrol ourselves - Group.GetColoredName(perm)); + Player.Message(p, "&cNo players to patrol."); } else { Player target = candidates[new Random().Next(candidates.Count)]; + target.LastPatrol = DateTime.UtcNow; Command.all.FindByName("TP").Use(p, target.name); Player.Message(p, "Now visiting " + target.ColoredName + "%S."); } @@ -51,9 +49,11 @@ namespace MCGalaxy.Commands.Moderation { List candidates = new List(); LevelPermission perm = CommandExtraPerms.MinPerm(name); Player[] online = PlayerInfo.Online.Items; + DateTime cutoff = DateTime.UtcNow.AddSeconds(-15); foreach (Player target in online) { if (target.Rank > perm || target == p || !Entities.CanSee(p, target)) continue; + if (target.LastPatrol > cutoff) continue; candidates.Add(target); } return candidates; @@ -62,8 +62,8 @@ namespace MCGalaxy.Commands.Moderation { public override void Help(Player p) { Player.Message(p, "%T/Patrol"); LevelPermission perm = CommandExtraPerms.MinPerm(name); - Player.Message(p, "%HTeleports you to a random {0} %Sor lower", - Group.GetColoredName(perm)); + Player.Message(p, "%HTeleports you to a random {0} %Hor lower", Group.GetColoredName(perm)); + Player.Message(p, "%HPlayers patrolled within the last 15 seconds are ignored"); } } } diff --git a/MCGalaxy/Commands/other/QuitCmds.cs b/MCGalaxy/Commands/other/QuitCmds.cs index 63e81201b..90cb1775f 100644 --- a/MCGalaxy/Commands/other/QuitCmds.cs +++ b/MCGalaxy/Commands/other/QuitCmds.cs @@ -64,7 +64,7 @@ namespace MCGalaxy.Commands.Misc { public override void Use(Player p, string message) { if (message.Length > 0) { Help(p); return; } - int code = p.random.Next(int.MinValue, int.MaxValue); + int code = new Random().Next(int.MinValue, int.MaxValue); p.Leave("Server crash! Error code 0x" + Convert.ToString(code, 16).ToUpper()); } diff --git a/MCGalaxy/Levels/LevelOptions.cs b/MCGalaxy/Levels/LevelOptions.cs index 20e6d7510..e726301d1 100644 --- a/MCGalaxy/Levels/LevelOptions.cs +++ b/MCGalaxy/Levels/LevelOptions.cs @@ -84,7 +84,6 @@ namespace MCGalaxy { pl.SendMapMotd(); } else { LevelActions.ReloadMap(p, pl, false); - if (pl.HasCpeExt(CpeExt.HackControl)) pl.Send(Hacks.MakeHackControl(pl)); } } } diff --git a/MCGalaxy/Player/Player.Fields.cs b/MCGalaxy/Player/Player.Fields.cs index d2bf84c9e..bddd95033 100644 --- a/MCGalaxy/Player/Player.Fields.cs +++ b/MCGalaxy/Player/Player.Fields.cs @@ -230,8 +230,7 @@ namespace MCGalaxy { public DateTime lastchatroomglobal; public WarpList Waypoints = new WarpList(); - - public Random random = new Random(); + public DateTime LastPatrol; public LevelPermission Rank { get { return group.Permission; } } public bool loggedIn;