예제 #1
0
        public override void Use(Player p, string message)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);
            Player   who  = PlayerInfo.FindMatches(p, args[0]);

            string reason = args.Length == 1 ? "you know why." : args[1];

            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }

            if (who == null)
            {
                WarnOffline(p, args, reason); return;
            }
            if (who == p)
            {
                Player.Message(p, "you can't warn yourself"); return;
            }
            if (p != null && p.Rank <= who.Rank)
            {
                MessageTooHighRank(p, "warn", false); return;
            }

            ModAction action = new ModAction(who.name, p, ModActionType.Warned, reason);

            OnModActionEvent.Call(action);
        }
예제 #2
0
        void DoFreeze(Player p, string target, string[] args)
        {
            if (args.Length < 2)
            {
                Help(p); return;
            }
            TimeSpan duration = TimeSpan.Zero;

            if (!CommandParser.GetTimespan(p, args[1], ref duration, "freeze for", "m"))
            {
                return;
            }

            string reason = args.Length > 2 ? args[2] : "";

            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }

            ModAction action = new ModAction(target, p, ModActionType.Frozen, reason, duration);

            OnModActionEvent.Call(action);
        }
예제 #3
0
        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);
        }
예제 #4
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);

            Player who = PlayerInfo.FindMatches(p, args[0]);

            if (who == null)
            {
                return;
            }
            string kickMsg = "by " + p.truename, reason = null;

            if (args.Length > 1)
            {
                reason = ModActionCmd.ExpandReason(p, args[1]);
                if (message == null)
                {
                    return;
                }
                kickMsg += "&f: " + reason;
            }

            ModAction action = new ModAction(who.name, p, ModActionType.Kicked, reason);

            OnModActionEvent.Call(action);
            who.Kick(kickMsg, "Kicked " + kickMsg);
        }
예제 #5
0
        static void Delete(Player p, string target)
        {
            string line = Server.tempRanks.FindData(target);

            if (line == null)
            {
                Player.Message(p, "{0}&c has not been assigned a temp rank.",
                               PlayerInfo.GetColoredName(p, target));
                return;
            }

            string[] parts   = line.SplitSpaces();
            Player   who     = PlayerInfo.FindExact(target);
            Group    curRank = who != null ? who.group : Group.GroupIn(target);

            Group oldRank = Group.Find(parts[4 - 1]); // -1 because data, not whole line

            if (oldRank == null)
            {
                return;
            }

            string reason = "temp rank unassigned";

            if (!CmdSetRank.CanChangeRank(target, curRank, oldRank, who, p, ref reason))
            {
                return;
            }

            ModAction action = new ModAction(target, p, ModActionType.Rank, reason);

            action.Metadata    = oldRank;
            action.targetGroup = curRank;
            OnModActionEvent.Call(action);
        }
예제 #6
0
        internal static void Delete(Player p, string target, CommandData data)
        {
            string line = Server.tempRanks.FindData(target);

            if (line == null)
            {
                p.Message("{0} &Whas not been assigned a temp rank.", p.FormatNick(target));
                return;
            }

            string[] parts   = line.SplitSpaces();
            Group    curRank = PlayerInfo.GetGroup(target);

            Group oldRank = Group.Find(parts[4 - 1]); // -1 because data, not whole line

            if (oldRank == null)
            {
                return;
            }

            string reason = "temp rank unassigned";

            if (!CmdSetRank.CanChangeRank(target, curRank, oldRank, p, data, ref reason))
            {
                return;
            }

            ModAction action = new ModAction(target, p, ModActionType.Rank, reason);

            action.Metadata    = oldRank;
            action.targetGroup = curRank;
            OnModActionEvent.Call(action);
        }
예제 #7
0
        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);
        }
예제 #8
0
        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] : "";

            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }

            if (!Server.tempBans.Contains(args[0]))
            {
                int matches;
                args[0] = Group.BannedRank.Players.FindMatches(p, args[0], "banned players", out matches);
                if (args[0] == null)
                {
                    return;
                }
            }

            ModAction action = new ModAction(args[0], p, ModActionType.Unban, reason);

            OnModActionEvent.Call(action);
        }
예제 #9
0
        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);
        }
예제 #10
0
        public override void Use(Player p, string message)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(3);

            Player who = PlayerInfo.FindMatches(p, args[0]);

            if (who == null)
            {
                return;
            }
            if (p != null && p == who)
            {
                Player.Message(p, "Cannot freeze yourself."); return;
            }
            if (p != null && who.Rank >= p.Rank)
            {
                MessageTooHighRank(p, "freeze", false); return;
            }

            if (who.frozen)
            {
                string reason = args.Length > 1 ? args[1] : "";
                reason = ModActionCmd.ExpandReason(p, reason);
                if (reason == null)
                {
                    return;
                }

                ModAction action = new ModAction(who.name, p, ModActionType.Unfrozen, reason);
                OnModActionEvent.Call(action);
            }
            else
            {
                if (args.Length < 2)
                {
                    Help(p); return;
                }
                TimeSpan duration = TimeSpan.Zero;
                if (!CommandParser.GetTimespan(p, args[1], ref duration, "freeze for", "m"))
                {
                    return;
                }

                string reason = args.Length > 2 ? args[2] : "";
                reason = ModActionCmd.ExpandReason(p, reason);
                if (reason == null)
                {
                    return;
                }

                ModAction action = new ModAction(who.name, p, ModActionType.Frozen, reason, duration);
                OnModActionEvent.Call(action);
            }
        }
예제 #11
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(3);

            Player who = PlayerInfo.FindMatches(p, args[0]);

            if (who == null)
            {
                return;
            }

            Group group = ModActionCmd.CheckTarget(p, data, "freeze", who.name);

            if (group == null)
            {
                return;
            }

            if (who.frozen)
            {
                string reason = args.Length > 1 ? args[1] : "";
                reason = ModActionCmd.ExpandReason(p, reason);
                if (reason == null)
                {
                    return;
                }

                ModAction action = new ModAction(who.name, p, ModActionType.Unfrozen, reason);
                OnModActionEvent.Call(action);
            }
            else
            {
                if (args.Length < 2)
                {
                    Help(p); return;
                }
                TimeSpan duration = TimeSpan.Zero;
                if (!CommandParser.GetTimespan(p, args[1], ref duration, "freeze for", "m"))
                {
                    return;
                }

                string reason = args.Length > 2 ? args[2] : "";
                reason = ModActionCmd.ExpandReason(p, reason);
                if (reason == null)
                {
                    return;
                }

                ModAction action = new ModAction(who.name, p, ModActionType.Frozen, reason, duration);
                OnModActionEvent.Call(action);
            }
        }
예제 #12
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);

            Player who = PlayerInfo.FindMatches(p, args[0]);

            if (who == null)
            {
                if (Server.muted.Contains(args[0]))
                {
                    Unmute(p, args[0], args);
                }
                return;
            }
            if (who.muted)
            {
                Unmute(p, who.name, args); return;
            }

            Group group = ModActionCmd.CheckTarget(p, data, "mute", who.name);

            if (group == null)
            {
                return;
            }

            // unmute has second argument as reason, mute has third argument instead
            args = message.SplitSpaces(3);

            TimeSpan duration = Server.Config.ChatSpamMuteTime;

            if (args.Length > 1)
            {
                if (!CommandParser.GetTimespan(p, args[1], ref duration, "mute for", "s"))
                {
                    return;
                }
            }

            string reason = args.Length > 2 ? args[2] : "";

            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }

            ModAction action = new ModAction(who.name, p, ModActionType.Muted, reason, duration);

            OnModActionEvent.Call(action);
        }
예제 #13
0
        public override void Use(Player p, string message)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(3);

            Player who = PlayerInfo.FindMatches(p, args[0]);

            if (who == null)
            {
                if (Server.muted.Contains(args[0]))
                {
                    Unmute(p, args[0], args);
                }
                return;
            }
            if (p != null && p == who)
            {
                Player.Message(p, "You cannot mute or unmute yourself."); return;
            }

            if (who.muted)
            {
                Unmute(p, who.name, args);
            }
            else
            {
                if (p != null && who.Rank >= p.Rank)
                {
                    MessageTooHighRank(p, "mute", false); return;
                }

                TimeSpan duration = TimeSpan.FromSeconds(ServerConfig.ChatSpamMuteTime);
                if (args.Length > 1)
                {
                    if (!CommandParser.GetTimespan(p, args[1], ref duration, "mute for", "s"))
                    {
                        return;
                    }
                }

                string reason = args.Length > 2 ? args[2] : "";
                reason = ModActionCmd.ExpandReason(p, reason);
                if (reason == null)
                {
                    return;
                }

                ModAction action = new ModAction(who.name, p, ModActionType.Muted, reason, duration);
                OnModActionEvent.Call(action);
            }
        }
예제 #14
0
        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);
        }
예제 #15
0
        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);
        }
예제 #16
0
        public override void Use(Player p, string message)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);

            Player who = PlayerInfo.FindMatches(p, args[0]);

            if (who == null)
            {
                return;
            }

            string kickMsg = null, reason = null;

            if (p == null)
            {
                kickMsg = "by (console)";
            }
            else
            {
                kickMsg = "by " + p.truename;
            }

            if (args.Length > 1)
            {
                reason = ModActionCmd.ExpandReason(p, args[1]);
                if (message == null)
                {
                    return;
                }
                kickMsg += "&f: " + reason;
            }

            if (p != null && p == who)
            {
                Player.Message(p, "You cannot kick yourself."); return;
            }
            if (p != null && who.Rank >= p.Rank)
            {
                Chat.MessageGlobal(p, p.ColoredName + " %Stried to kick "
                                   + who.ColoredName + " %Sbut failed.", false);
                return;
            }

            ModAction action = new ModAction(who.name, p, ModActionType.Kicked, reason);

            OnModActionEvent.Call(action);
            who.Kick(kickMsg, "Kicked " + kickMsg);
        }
예제 #17
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);
            string   name, addr = ModActionCmd.FindIP(p, args[0], "BanIP", out name);

            if (addr == null)
            {
                return;
            }

            IPAddress ip;

            if (!IPAddress.TryParse(addr, out ip))
            {
                p.Message("\"{0}\" is not a valid IP.", addr); return;
            }
            if (IPAddress.IsLoopback(ip))
            {
                p.Message("You cannot IP ban the server."); return;
            }
            if (ip.Equals(p.IP))
            {
                p.Message("You cannot IP ban yourself."); return;
            }
            if (Server.bannedIP.Contains(addr))
            {
                p.Message("{0} is already IP banned.", addr); return;
            }

            // Check if IP is shared by any other higher ranked accounts
            if (!CheckIP(p, data, addr))
            {
                return;
            }

            string reason = args.Length > 1 ? args[1] : "";

            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }

            ModAction action = new ModAction(addr, p, ModActionType.BanIP, reason);

            OnModActionEvent.Call(action);
        }
예제 #18
0
        static void WarnOffline(Player p, string[] args, string reason)
        {
            Player.Message(p, "Searching PlayerDB..");
            string offName = PlayerInfo.FindOfflineNameMatches(p, args[0]);

            if (offName == null)
            {
                return;
            }

            ModAction action = new ModAction(offName, p, ModActionType.Warned, reason);

            OnModActionEvent.Call(action);
        }
예제 #19
0
        static void Unmute(Player p, string name, string[] args)
        {
            string reason = args.Length > 1 ? args[1] : "";

            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }

            ModAction action = new ModAction(name, p, ModActionType.Unmuted, reason);

            OnModActionEvent.Call(action);
        }
예제 #20
0
        void DoUnfreeze(Player p, string target, string[] args)
        {
            string reason = args.Length > 1 ? args[1] : "";

            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }

            ModAction action = new ModAction(target, p, ModActionType.Unfrozen, reason);

            OnModActionEvent.Call(action);
        }
예제 #21
0
        public override void Use(Player p, string message)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);
            args[0] = ModActionCmd.FindIP(p, args[0], "IP ban", "banip");
            if (args[0] == null)
            {
                return;
            }

            IPAddress ip;

            if (!IPAddress.TryParse(args[0], out ip))
            {
                Player.Message(p, "\"{0}\" is not a valid IP.", args[0]); return;
            }
            if (IPAddress.IsLoopback(ip))
            {
                Player.Message(p, "You cannot IP ban the server."); return;
            }
            if (p != null && p.ip == args[0])
            {
                Player.Message(p, "You cannot IP ban yourself."); return;
            }
            if (Server.bannedIP.Contains(args[0]))
            {
                Player.Message(p, "{0} is already IP banned.", args[0]); return;
            }
            // Check if IP is shared by any other higher ranked accounts
            if (!CheckIP(p, args[0]))
            {
                return;
            }

            string reason = args.Length > 1 ? args[1] : "";

            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }

            ModAction action = new ModAction(args[0], p, ModActionType.BanIP, reason);

            OnModActionEvent.Call(action);
        }
예제 #22
0
        void DoUnmute(Player p, string target, string reason)
        {
            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }
            if (p.name == target)
            {
                p.Message("You cannot unmute yourself."); return;
            }

            ModAction action = new ModAction(target, p, ModActionType.Unmuted, reason);

            OnModActionEvent.Call(action);
        }
예제 #23
0
        static void Assign(Player p, string[] args, CommandData data)
        {
            string target = PlayerInfo.FindMatchesPreferOnline(p, args[0]);

            if (target == null)
            {
                return;
            }

            Group newRank = Matcher.FindRanks(p, args[1]);

            if (newRank == null)
            {
                return;
            }
            TimeSpan duration = TimeSpan.Zero;

            if (!CommandParser.GetTimespan(p, args[2], ref duration, "temp rank for", "h"))
            {
                return;
            }

            if (Server.tempRanks.Contains(target))
            {
                p.Message("&WThe player already has a temporary rank assigned!"); return;
            }

            if (p.name.CaselessEq(target))
            {
                p.Message("&WYou cannot assign yourself a temporary rank."); return;
            }

            Group  curRank = PlayerInfo.GetGroup(target);
            string reason  = args.Length > 3 ? args[3] : "assigning temp rank";

            if (!CmdSetRank.CanChangeRank(target, curRank, newRank, p, data, ref reason))
            {
                return;
            }

            ModAction action = new ModAction(target, p, ModActionType.Rank, reason, duration);

            action.targetGroup = curRank;
            action.Metadata    = newRank;
            OnModActionEvent.Call(action);
        }
예제 #24
0
        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] : "";

            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }

            if (message.CaselessEq("set") && p != null)
            {
                p.level.Config.JailX    = p.Pos.X; p.level.Config.JailY = p.Pos.Y; p.level.Config.JailZ = p.Pos.Z;
                p.level.Config.jailrotx = p.Rot.RotY; p.level.Config.jailroty = p.Rot.HeadX;
                Player.Message(p, "Set Jail point.");
                return;
            }

            Player who = PlayerInfo.FindMatches(p, args[0]);

            if (who == null)
            {
                return;
            }

            if (!who.jailed)
            {
                if (p != null && who.Rank >= p.Rank)
                {
                    MessageTooHighRank(p, "jail", false); return;
                }
                ModAction action = new ModAction(who.name, p, ModActionType.Jailed, reason);
                OnModActionEvent.Call(action);
            }
            else
            {
                ModAction action = new ModAction(who.name, p, ModActionType.Unjailed, reason);
                OnModActionEvent.Call(action);
            }
        }
예제 #25
0
        static void Unmute(Player p, string name, string[] args)
        {
            string reason = args.Length > 1 ? args[1] : "";

            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }
            if (p.name == name)
            {
                p.Message("You cannot unmute yourself."); return;
            }

            ModAction action = new ModAction(name, p, ModActionType.Unmuted, reason);

            OnModActionEvent.Call(action);
        }
예제 #26
0
        public bool CheckChatSpam()
        {
            Player.lastMSG = p.name;
            if (!ServerConfig.ChatSpamCheck || p.IsSuper)
            {
                return(false);
            }

            lock (chatLock) {
                if (chatLog.AddSpamEntry(ServerConfig.ChatSpamCount, ServerConfig.ChatSpamInterval))
                {
                    return(false);
                }

                TimeSpan  duration = ServerConfig.ChatSpamMuteTime;
                ModAction action   = new ModAction(p.name, Player.Console, ModActionType.Muted, "&0Auto mute for spamming", duration);
                OnModActionEvent.Call(action);
                return(true);
            }
        }
예제 #27
0
        static void CheckLoginJailed(Player p)
        {
            string level = Server.jailed.FindData(p.name);

            if (level == null)
            {
                return;
            }

            try {
                PlayerActions.ChangeMap(p, level);
                ModAction action = new ModAction(p.name, null, ModActionType.Jailed, "Auto jail");
                action.Announce = false;
                OnModActionEvent.Call(action);
                Chat.MessageGlobal(p, p.DisplayName + " &cis still jailed from previously.", false);
            } catch (Exception ex) {
                p.Leave("Error occured", "Error occured", true);
                Logger.LogError(ex);
            }
        }
예제 #28
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);
            string   name, addr = ModActionCmd.FindIP(p, args[0], "UnbanIP", out name);

            if (addr == null)
            {
                return;
            }

            IPAddress ip;

            if (!IPAddress.TryParse(addr, out ip))
            {
                p.Message("\"{0}\" is not a valid IP.", addr); return;
            }
            if (p.ip == addr)
            {
                p.Message("You cannot un-IP ban yourself."); return;
            }
            if (!Server.bannedIP.Contains(addr))
            {
                p.Message(addr + " is not a banned IP."); return;
            }

            string reason = args.Length > 1 ? args[1] : "";

            reason = ModActionCmd.ExpandReason(p, reason);
            if (reason == null)
            {
                return;
            }

            ModAction action = new ModAction(addr, p, ModActionType.UnbanIP, reason);

            OnModActionEvent.Call(action);
        }
예제 #29
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);

            Player who = PlayerInfo.FindMatches(p, args[0]);

            if (who == null)
            {
                return;
            }
            string kickMsg = "by " + p.truename, reason = null;

            if (args.Length > 1)
            {
                reason = ModActionCmd.ExpandReason(p, args[1]);
                if (message == null)
                {
                    return;
                }
                kickMsg += "&f: " + reason;
            }

            if (p == who)
            {
                p.Message("You cannot kick yourself."); return;
            }
            if (who.Rank >= data.Rank)
            {
                Chat.MessageFrom(p, "λNICK &Stried to kick " + who.ColoredName + " &Sbut failed.");
                return;
            }

            ModAction action = new ModAction(who.name, p, ModActionType.Kicked, reason);

            OnModActionEvent.Call(action);
            who.Kick(kickMsg, "Kicked " + kickMsg);
        }
예제 #30
0
        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);
        }