Exemple #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);
        }
Exemple #2
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);
        }
Exemple #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 ? 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);
        }
Exemple #4
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);
        }
Exemple #5
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);
        }
Exemple #6
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);
        }
Exemple #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);
        }
Exemple #8
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);
        }
Exemple #9
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);
        }
Exemple #10
0
 public override void Unload(bool shutdown)
 {
     OnPlayerConnectEvent.Unregister(HandleConnect);
     OnPlayerDisconnectEvent.Unregister(HandleDisconnect);
     OnPlayerChatEvent.Unregister(HandleChat);
     OnPlayerActionEvent.Unregister(HandlePlayerAction);
     OnModActionEvent.Unregister(HandleModerationAction);
 }
Exemple #11
0
 public override void Load(bool startup)
 {
     OnPlayerConnectEvent.Register(HandleConnect, Priority.Low);
     OnPlayerDisconnectEvent.Register(HandleDisconnect, Priority.Low);
     OnPlayerChatEvent.Register(HandleChat, Priority.Low);
     OnPlayerActionEvent.Register(HandlePlayerAction, Priority.Low);
     OnModActionEvent.Register(HandleModerationAction, Priority.Low);
 }
Exemple #12
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);
            }
        }
Exemple #13
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);
            }
        }
Exemple #14
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);
        }
Exemple #15
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);
            }
        }
Exemple #16
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);
        }
Exemple #17
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);
        }
Exemple #18
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);
        }
Exemple #19
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);
        }
Exemple #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);
        }
Exemple #21
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);
        }
Exemple #22
0
 public override void Unload(bool shutdown) {
     OnPlayerConnectEvent.Unregister(ConnectHandler.HandleConnect);
     OnPlayerCommandEvent.Unregister(ChatHandler.HandleCommand);
     OnChatEvent.Unregister(ChatHandler.HandleOnChat);
     OnPlayerStartConnectingEvent.Unregister(ConnectingHandler.HandleConnecting);
     
     OnSentMapEvent.Unregister(MiscHandlers.HandleOnMapSent);
     OnPlayerMoveEvent.Unregister(MiscHandlers.HandlePlayerMove);
     OnPlayerClickEvent.Unregister(MiscHandlers.HandlePlayerClick);
     
     OnEcoTransactionEvent.Unregister(EcoHandlers.HandleEcoTransaction);
     OnModActionEvent.Unregister(ModActionHandler.HandleModAction);            
     Server.Background.Cancel(clearTask);
 }
Exemple #23
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);
        }
Exemple #24
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);
        }
Exemple #25
0
        public override void Load(bool startup)
        {
            OnPlayerConnectEvent.Register(ConnectHandler.HandleConnect, Priority.Critical);
            OnPlayerCommandEvent.Register(ChatHandler.HandleCommand, Priority.Critical);
            OnChatEvent.Register(ChatHandler.HandleOnChat, Priority.Critical);
            OnPlayerStartConnectingEvent.Register(ConnectingHandler.HandleConnecting, Priority.Critical);

            OnSentMapEvent.Register(MiscHandlers.HandleSentMap, Priority.Critical);
            OnPlayerMoveEvent.Register(MiscHandlers.HandlePlayerMove, Priority.Critical);
            OnPlayerClickEvent.Register(MiscHandlers.HandlePlayerClick, Priority.Critical);
            OnChangedZoneEvent.Register(MiscHandlers.HandleChangedZone, Priority.Critical);

            OnEcoTransactionEvent.Register(EcoHandlers.HandleEcoTransaction, Priority.Critical);
            OnModActionEvent.Register(ModActionHandler.HandleModAction, Priority.Critical);
        }
Exemple #26
0
 public override void Load(bool startup) {
     OnPlayerConnectEvent.Register(ConnectHandler.HandleConnect, Priority.Critical);
     OnPlayerCommandEvent.Register(ChatHandler.HandleCommand, Priority.Critical);
     OnChatEvent.Register(ChatHandler.HandleOnChat, Priority.Critical);
     OnPlayerStartConnectingEvent.Register(ConnectingHandler.HandleConnecting, Priority.Critical);
     
     OnSentMapEvent.Register(MiscHandlers.HandleOnMapSent, Priority.Critical);
     OnPlayerMoveEvent.Register(MiscHandlers.HandlePlayerMove, Priority.Critical);
     OnPlayerClickEvent.Register(MiscHandlers.HandlePlayerClick, Priority.Critical);
     
     OnEcoTransactionEvent.Register(EcoHandlers.HandleEcoTransaction, Priority.Critical);
     OnModActionEvent.Register(ModActionHandler.HandleModAction, Priority.Critical);
     clearTask = Server.Background.QueueRepeat(IPThrottler.CleanupTask, null, 
                                               TimeSpan.FromMinutes(10));
 }
Exemple #27
0
        public override void Unload(bool shutdown)
        {
            OnPlayerConnectEvent.Unregister(ConnectHandler.HandleConnect);
            OnPlayerCommandEvent.Unregister(ChatHandler.HandleCommand);
            OnChatEvent.Unregister(ChatHandler.HandleOnChat);
            OnPlayerStartConnectingEvent.Unregister(ConnectingHandler.HandleConnecting);

            OnSentMapEvent.Unregister(MiscHandlers.HandleSentMap);
            OnPlayerMoveEvent.Unregister(MiscHandlers.HandlePlayerMove);
            OnPlayerClickEvent.Unregister(MiscHandlers.HandlePlayerClick);
            OnChangedZoneEvent.Unregister(MiscHandlers.HandleChangedZone);

            OnEcoTransactionEvent.Unregister(EcoHandlers.HandleEcoTransaction);
            OnModActionEvent.Unregister(ModActionHandler.HandleModAction);
        }
Exemple #28
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);
        }
Exemple #29
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);
        }
Exemple #30
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);
            }
        }