public override void Use(Player p, string message, CommandData data) { if (message.Length == 0) { Help(p); return; } string[] args = message.SplitSpaces(2); string reason = args.Length == 1 ? "you know why." : args[1]; string target = ModActionCmd.FindName(p, "warn", "Warn", "", args[0], ref reason); if (target == null) { return; } reason = ModActionCmd.ExpandReason(p, reason); if (reason == null) { return; } Group group = ModActionCmd.CheckTarget(p, data, "warn", target); if (group == null) { return; } ModAction action = new ModAction(target, p, ModActionType.Warned, reason); OnModActionEvent.Call(action); }
public override void Use(Player p, string message, CommandData data) { string[] args = message.SplitSpaces(3); if (args.Length < 2) { Help(p); return; } string rankName, target; string reason = args.Length > 2 ? args[2] : null; if (args[0].CaselessEq("+up")) { rankName = args[0]; target = ModActionCmd.FindName(p, "promote", "Promote", "", args[1], ref reason); } else if (args[0].CaselessEq("-down")) { rankName = args[0]; target = ModActionCmd.FindName(p, "demote", "Demote", "", args[1], ref reason); } else { rankName = args[1]; target = ModActionCmd.FindName(p, "rank", "Rank", " " + rankName, args[0], ref reason); } if (target == null) { return; } if (p.name.CaselessEq(target)) { p.Message("Cannot change your own rank."); return; } Group curRank = PlayerInfo.GetGroup(target); Group newRank = TargetRank(p, rankName, curRank); if (newRank == null) { return; } if (curRank == newRank) { p.Message("{0} %Sis already ranked {1}", p.FormatNick(target), curRank.ColoredName); return; } if (!CanChangeRank(target, curRank, newRank, p, data, ref reason)) { return; } ModAction action = new ModAction(target, p, ModActionType.Rank, reason); action.targetGroup = curRank; action.Metadata = newRank; OnModActionEvent.Call(action); }
public override void Use(Player p, string message) { if (message.Length == 0) { Help(p); return; } string[] args = message.SplitSpaces(2); string reason = args.Length > 1 ? args[1] : ""; string target = ModActionCmd.FindName(p, "ban", "Ban", "", args[0], ref reason); if (target == null) { return; } reason = ModActionCmd.ExpandReason(p, reason); if (reason == null) { return; } Player who = PlayerInfo.FindExact(target); Group group = who != null ? who.group : Group.GroupIn(target); if (!CheckPerms(target, group, p)) { return; } ModAction action = new ModAction(target, p, ModActionType.Ban, reason); action.targetGroup = group; OnModActionEvent.Call(action); }
public override void Use(Player p, string message, CommandData data) { if (message.Length == 0) { Help(p); return; } string[] args = message.SplitSpaces(3); string reason = args.Length > 2 ? args[2] : ""; string target = ModActionCmd.FindName(p, "temp ban", "TempBan", args.Length == 1 ? "" : " " + args[1], args[0], ref reason); if (target == null) { return; } Group group = ModActionCmd.CheckTarget(p, data, "temp ban", target); if (group == null) { return; } if (Server.tempBans.Contains(target)) { p.Message("{0} &Sis already temp-banned.", p.FormatNick(target)); return; } TimeSpan span = TimeSpan.FromHours(1); if (args.Length > 1 && !CommandParser.GetTimespan(p, args[1], ref span, "temp ban for", "m")) { return; } if (span.TotalSeconds < 1) { p.Message("Cannot temp ban someone for less than a second."); return; } reason = ModActionCmd.ExpandReason(p, reason); if (reason == null) { return; } ModAction action = new ModAction(target, p, ModActionType.Ban, reason, span); action.targetGroup = group; OnModActionEvent.Call(action); }
public override void Use(Player p, string message) { if (message.Length == 0) { Help(p); return; } string[] args = message.SplitSpaces(3); string reason = args.Length > 2 ? args[2] : ""; string target = ModActionCmd.FindName(p, "temp ban", "TempBan", args.Length == 1 ? "" : " " + args[1], args[0], ref reason); if (target == null) { return; } Player who = PlayerInfo.FindExact(target); Group grp = who == null?PlayerInfo.GetGroup(target) : who.group; if (p != null && grp.Permission >= p.Rank) { MessageTooHighRank(p, "temp ban", false); return; } if (Server.tempBans.Contains(target)) { Player.Message(p, "{0} %Sis already temp-banned.", PlayerInfo.GetColoredName(p, target)); return; } TimeSpan span = TimeSpan.FromHours(1); if (args.Length > 1 && !CommandParser.GetTimespan(p, args[1], ref span, "temp ban for", "m")) { return; } if (span.TotalSeconds < 1) { Player.Message(p, "Cannot temp ban someone for less than a second."); return; } reason = ModActionCmd.ExpandReason(p, reason); if (reason == null) { return; } ModAction action = new ModAction(target, p, ModActionType.Ban, reason, span); action.targetGroup = grp; OnModActionEvent.Call(action); }
public override void Use(Player p, string message, CommandData data) { if (message.Length == 0) { Help(p); return; } string[] args = message.SplitSpaces(2); string reason = args.Length > 1 ? args[1] : ""; string target = ModActionCmd.FindName(p, "ban", "Ban", "", args[0], ref reason); if (target == null) { return; } reason = ModActionCmd.ExpandReason(p, reason); if (reason == null) { return; } Group group = ModActionCmd.CheckTarget(p, data, "ban", target); if (group == null) { return; } if (group.Permission == LevelPermission.Banned) { p.Message("{0} %Sis already banned.", p.FormatNick(target)); return; } ModAction action = new ModAction(target, p, ModActionType.Ban, reason); action.targetGroup = group; OnModActionEvent.Call(action); }
public override void Use(Player p, string message) { string[] args = message.SplitSpaces(3); if (args.Length < 2) { Help(p); return; } string rankName = null, name = null; string reason = args.Length > 2 ? args[2] : null; if (args[0].CaselessEq("+up")) { rankName = args[0]; name = ModActionCmd.FindName(p, "promote", "Promote", "", args[1], ref reason); } else if (args[0].CaselessEq("-down")) { rankName = args[0]; name = ModActionCmd.FindName(p, "demote", "Demote", "", args[1], ref reason); } else { rankName = args[1]; name = ModActionCmd.FindName(p, "rank", "Rank", " " + rankName, args[0], ref reason); } if (name == null) { return; } Player who = PlayerInfo.FindExact(name); if (p == who && who != null) { Player.Message(p, "Cannot change your own rank."); return; } Group curRank = who != null ? who.group : PlayerInfo.GetGroup(name); Group newRank = TargetRank(p, rankName, curRank); if (newRank == null) { return; } if (curRank == newRank) { Player.Message(p, "{0} %Sis already ranked {1}", PlayerInfo.GetColoredName(p, name), curRank.ColoredName); return; } if (!CanChangeRank(name, curRank, newRank, who, p, ref reason)) { return; } ModAction action = new ModAction(name, p, ModActionType.Rank, reason); action.targetGroup = curRank; action.Metadata = newRank; OnModActionEvent.Call(action); }