void HandleEnter(Player p, CommandData data) { if (p.IsSuper) { p.Message("{0} cannot enter the review queue.", p.SuperName); return; } TimeSpan delta = p.NextReviewTime - DateTime.UtcNow; if (delta.TotalSeconds >= 0) { p.Message("You must wait {0} before you can request another review", delta.Shorten(true, true)); return; } if (Server.reviewlist.CaselessContains(p.name)) { p.Message("You are already in the review queue!"); return; } bool opsOn = false; Player[] players = PlayerInfo.Online.Items; ItemPerms nextPerms = CommandExtraPerms.Find("Review", 2); foreach (Player pl in players) { if (nextPerms.UsableBy(pl.Rank) && Entities.CanSee(data, p, pl)) { opsOn = true; break; } } Server.reviewlist.Add(p.name); int pos = Server.reviewlist.IndexOf(p.name) + 1; p.Message("You entered the &creview %Squeue at &aposition #" + pos); string msg = opsOn ? "The online staff have been notified. Someone should be with you shortly." : "There are currently no staff online. Staff will be notified when they join the server."; p.Message(msg); Chat.MessageFrom(ChatScope.Perms, p, "λNICK %Srequested a review! &c(Total " + pos + " waiting)", nextPerms, null, true); p.NextReviewTime = DateTime.UtcNow.Add(ServerConfig.ReviewCooldown); }
public static bool CanEditAny(Player p) { if (LevelInfo.IsRealmOwner(p.name, p.level.name)) { return(true); } ItemPerms perms = CommandExtraPerms.Find("EffectSpawner", 1); perms = perms == null ? new ItemPerms(LevelPermission.Operator, null, null) : perms; if (perms.UsableBy(p.Rank)) { return(true); } return(false); }
protected void SetPerms(Player p, string[] args, CommandData data, ItemPerms perms, string type) { string grpName = args[1]; if (!perms.UsableBy(data.Rank)) { p.Message("You rank cannot use this {0}.", type); return; } if (grpName[0] == '+') { Group grp = GetGroup(p, data, grpName.Substring(1)); if (grp == null) { return; } Allow(perms, grp.Permission); UpdatePerms(perms, p, " &Scan now be used by " + grp.ColoredName); } else if (grpName[0] == '-') { Group grp = GetGroup(p, data, grpName.Substring(1)); if (grp == null) { return; } if (data.Rank == grp.Permission) { p.Message("You cannot disallow your own rank from using a {0}.", type); return; } Disallow(perms, grp.Permission); UpdatePerms(perms, p, " &Sis no longer usable by " + grp.ColoredName); } else { Group grp = GetGroup(p, data, grpName); if (grp == null) { return; } perms.MinRank = grp.Permission; UpdatePerms(perms, p, " &Sis now usable by " + grp.ColoredName + "&S+"); } }
public static void IPLine(Player p, string name, string ip) { ItemPerms seeIpPerms = CommandExtraPerms.Find("WhoIs", 1); if (!seeIpPerms.UsableBy(p.Rank)) { return; } string ipMsg = ip; if (Server.bannedIP.Contains(ip)) { ipMsg = "&8" + ip + ", which is banned"; } p.Message(" The IP of " + ipMsg); if (Server.Config.WhitelistedOnly && Server.whiteList.Contains(name)) { p.Message(" Player is &fWhitelisted"); } }
List <Player> GetPatrolCandidates(Player p, CommandData data) { List <Player> candidates = new List <Player>(); ItemPerms except = CommandExtraPerms.Find(name, 1); Player[] players = PlayerInfo.Online.Items; DateTime cutoff = DateTime.UtcNow.AddSeconds(-15); foreach (Player target in players) { if (except.UsableBy(target.Rank) || !Entities.CanSee(data, p, target)) { continue; } if (target == p || target.LastPatrol > cutoff) { continue; } candidates.Add(target); } return(candidates); }
static void CheckReviewList(Player p) { if (!p.group.CanExecute("Review")) { return; } ItemPerms checkPerms = CommandExtraPerms.Find("Review", 1); if (!checkPerms.UsableBy(p.Rank)) { return; } int count = Server.reviewlist.Count; if (count == 0) { return; } string suffix = count == 1 ? " player is " : " players are "; p.Message(count + suffix + "waiting for a review. Type %T/Review view"); }