Esempio n. 1
0
        private void parseMessage(string message)
        {
            string type = JObject.Parse(message).SelectToken("type")?.ToString();

            switch (type.ToLower())
            {
            case "response":
                Models.PubSub.Responses.Response resp = new Models.PubSub.Responses.Response(message);
                if (previousRequest != null && previousRequest.Nonce.ToLower() == resp.Nonce.ToLower())
                {
                    OnListenResponse?.Invoke(this, new OnListenResponseArgs {
                        Response = resp, Topic = previousRequest.Topic, Successful = resp.Successful
                    });
                    return;
                }
                break;

            case "message":
                Models.PubSub.Responses.Message msg = new Models.PubSub.Responses.Message(message);
                switch (msg.Topic.Split('.')[0])
                {
                case "channel-subscribe-events-v1":
                    ChannelSubscription subscription = (ChannelSubscription)msg.messageData;
                    OnChannelSubscription?.Invoke(this, new OnChannelSubscriptionArgs {
                        Subscription = subscription
                    });
                    return;

                case "whispers":
                    Whisper whisper = (Whisper)msg.messageData;
                    OnWhisper?.Invoke(this, new OnWhisperArgs {
                        Whisper = whisper
                    });
                    return;

                case "chat_moderator_actions":
                    ChatModeratorActions cMA = (ChatModeratorActions)msg.messageData;
                    string reason            = "";
                    switch (cMA.ModerationAction.ToLower())
                    {
                    case "timeout":
                        if (cMA.Args.Count > 2)
                        {
                            reason = cMA.Args[2];
                        }
                        OnTimeout?.Invoke(this, new OnTimeoutArgs {
                            TimedoutBy      = cMA.CreatedBy, TimedoutUser = cMA.Args[0],
                            TimeoutDuration = TimeSpan.FromSeconds(int.Parse(cMA.Args[1])), TimeoutReason = reason
                        });
                        return;

                    case "ban":
                        if (cMA.Args.Count > 1)
                        {
                            reason = cMA.Args[1];
                        }
                        OnBan?.Invoke(this, new OnBanArgs {
                            BannedBy = cMA.CreatedBy, BannedUser = cMA.Args[0], BanReason = reason
                        });
                        return;

                    case "unban":
                        OnUnban?.Invoke(this, new OnUnbanArgs {
                            UnbannedBy = cMA.CreatedBy, UnbannedUser = cMA.Args[0]
                        });
                        return;

                    case "untimeout":
                        OnUntimeout?.Invoke(this, new OnUntimeoutArgs {
                            UntimeoutedBy = cMA.CreatedBy, UntimeoutedUser = cMA.Args[0]
                        });
                        return;

                    case "host":
                        OnHost?.Invoke(this, new OnHostArgs {
                            HostedChannel = cMA.Args[0], Moderator = cMA.CreatedBy
                        });
                        return;

                    case "subscribers":
                        OnSubscribersOnly?.Invoke(this, new OnSubscribersOnlyArgs {
                            Moderator = cMA.CreatedBy
                        });
                        return;

                    case "subscribersoff":
                        OnSubscribersOnlyOff?.Invoke(this, new OnSubscribersOnlyOffArgs {
                            Moderator = cMA.CreatedBy
                        });
                        return;

                    case "clear":
                        OnClear?.Invoke(this, new OnClearArgs {
                            Moderator = cMA.CreatedBy
                        });
                        return;

                    case "emoteonly":
                        OnEmoteOnly?.Invoke(this, new OnEmoteOnlyArgs {
                            Moderator = cMA.CreatedBy
                        });
                        return;

                    case "emoteonlyoff":
                        OnEmoteOnlyOff?.Invoke(this, new OnEmoteOnlyOffArgs {
                            Moderator = cMA.CreatedBy
                        });
                        return;

                    case "r9kbeta":
                        OnR9kBeta?.Invoke(this, new OnR9kBetaArgs {
                            Moderator = cMA.CreatedBy
                        });
                        return;

                    case "r9kbetaoff":
                        OnR9kBetaOff?.Invoke(this, new OnR9kBetaOffArgs {
                            Moderator = cMA.CreatedBy
                        });
                        return;
                    }
                    break;

                case "channel-bitsevents":
                    ChannelBitsEvents cBE = (ChannelBitsEvents)msg.messageData;
                    OnBitsReceived?.Invoke(this, new OnBitsReceivedArgs {
                        BitsUsed    = cBE.BitsUsed, ChannelId = cBE.ChannelId, ChannelName = cBE.ChannelName,
                        ChatMessage = cBE.ChatMessage, Context = cBE.Context, Time = cBE.Time, TotalBitsUsed = cBE.TotalBitsUsed, UserId = cBE.UserId, Username = cBE.Username
                    });
                    return;

                case "video-playback":
                    VideoPlayback vP = (VideoPlayback)msg.messageData;
                    switch (vP.Type)
                    {
                    case Enums.VideoPlaybackType.StreamDown:
                        OnStreamDown?.Invoke(this, new OnStreamDownArgs {
                            PlayDelay = vP.PlayDelay, ServerTime = vP.ServerTime
                        });
                        return;

                    case Enums.VideoPlaybackType.StreamUp:
                        OnStreamUp?.Invoke(this, new OnStreamUpArgs {
                            PlayDelay = vP.PlayDelay, ServerTime = vP.ServerTime
                        });
                        return;

                    case Enums.VideoPlaybackType.ViewCount:
                        OnViewCount?.Invoke(this, new OnViewCountArgs {
                            ServerTime = vP.ServerTime, Viewers = vP.Viewers
                        });
                        return;
                    }
                    break;
                }
                break;
            }
            if (logging)
            {
                unaccountedFor(message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Send the ZreMsgOriginal to the socket.
        /// </summary>
        public void Send(IOutgoingSocket output)
        {
            if (output is RouterSocket)
            {
                output.SendMoreFrame(RoutingId);
            }

            int frameSize = 2 + 1;                      //  Signature and message ID

            switch (Id)
            {
            case MessageId.Hello:
                frameSize += Hello.GetFrameSize();
                break;

            case MessageId.Whisper:
                frameSize += Whisper.GetFrameSize();
                break;

            case MessageId.Shout:
                frameSize += Shout.GetFrameSize();
                break;

            case MessageId.Join:
                frameSize += Join.GetFrameSize();
                break;

            case MessageId.Leave:
                frameSize += Leave.GetFrameSize();
                break;

            case MessageId.Ping:
                frameSize += Ping.GetFrameSize();
                break;

            case MessageId.PingOk:
                frameSize += PingOk.GetFrameSize();
                break;
            }

            //  Now serialize message into the buffer
            Msg msg = new Msg();

            msg.InitPool(frameSize);

            try
            {
                m_offset = 0;
                m_buffer = msg.Data;

                // put signature
                PutNumber2(0xAAA0 | 1);

                // put message id
                PutNumber1((byte)Id);

                switch (Id)
                {
                case MessageId.Hello:
                    Hello.Write(this);
                    break;

                case MessageId.Whisper:
                    Whisper.Write(this);
                    break;

                case MessageId.Shout:
                    Shout.Write(this);
                    break;

                case MessageId.Join:
                    Join.Write(this);
                    break;

                case MessageId.Leave:
                    Leave.Write(this);
                    break;

                case MessageId.Ping:
                    Ping.Write(this);
                    break;

                case MessageId.PingOk:
                    PingOk.Write(this);
                    break;
                }

                //  Send the data frame
                output.Send(ref msg, false);
            }
            finally
            {
                m_buffer = null;
                msg.Close();
            }
        }
Esempio n. 3
0
 public ExtTalk(Whisper talk) : base(talk.Idx, talk.Day, talk.Turn, talk.Agent, talk.Text)
 {
     Content = new Content(talk.Text);
 }
Esempio n. 4
0
        /// <summary>
        /// Receive a ZreMsg from the socket.
        /// </summary>
        public void Receive(IReceivingSocket input)
        {
            bool more;

            if (input is RouterSocket)
            {
                Msg routingIdMsg = new Msg();
                routingIdMsg.InitEmpty();

                try
                {
                    input.Receive(ref routingIdMsg);

                    if (!routingIdMsg.HasMore)
                    {
                        throw new MessageException("No routing id");
                    }

                    if (m_routingId == null || m_routingId.Length == routingIdMsg.Size)
                    {
                        m_routingId = new byte[routingIdMsg.Size];
                    }

                    Buffer.BlockCopy(routingIdMsg.Data, 0, m_routingId, 0, m_routingId.Length);
                }
                finally
                {
                    routingIdMsg.Close();
                }
            }
            else
            {
                RoutingId = null;
            }

            Msg msg = new Msg();

            msg.InitEmpty();

            try
            {
                input.Receive(ref msg);

                m_offset = 0;
                m_buffer = msg.Data;
                more     = msg.HasMore;

                UInt16 signature = GetNumber2();

                if (signature != (0xAAA0 | 1))
                {
                    throw new MessageException("Invalid signature");
                }

                //  Get message id and parse per message type
                Id = (MessageId)GetNumber1();

                switch (Id)
                {
                case MessageId.Hello:
                    Hello.Read(this);
                    break;

                case MessageId.Whisper:
                    Whisper.Read(this);
                    break;

                case MessageId.Shout:
                    Shout.Read(this);
                    break;

                case MessageId.Join:
                    Join.Read(this);
                    break;

                case MessageId.Leave:
                    Leave.Read(this);
                    break;

                case MessageId.Ping:
                    Ping.Read(this);
                    break;

                case MessageId.PingOk:
                    PingOk.Read(this);
                    break;

                default:
                    throw new MessageException("Bad message id");
                }

                // Receive message content for types with content
                switch (Id)
                {
                case MessageId.Whisper:
                    Whisper.Content = input.ReceiveMultipartMessage();
                    break;

                case MessageId.Shout:
                    Shout.Content = input.ReceiveMultipartMessage();
                    break;
                }
            }
            finally
            {
                m_buffer = null;
                msg.Close();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Send the ZreMsg to the socket.
        /// Warning re WHISPER and SHOUT: The 0MQ spec http://rfc.zeromq.org/spec:36
        ///     says "message content defined as one 0MQ frame. ZRE does not support multi-frame message contents."
        /// </summary>
        public void Send(IOutgoingSocket output)
        {
            if (output is RouterSocket)
            {
                output.SendMoreFrame(RoutingId);
            }

            int frameSize = 2 + 1; //  Signature and message ID

            switch (Id)
            {
            case MessageId.Hello:
                frameSize += Hello.GetFrameSize();
                break;

            case MessageId.Whisper:
                frameSize += Whisper.GetFrameSize();
                break;

            case MessageId.Shout:
                frameSize += Shout.GetFrameSize();
                break;

            case MessageId.Join:
                frameSize += Join.GetFrameSize();
                break;

            case MessageId.Leave:
                frameSize += Leave.GetFrameSize();
                break;

            case MessageId.Ping:
                frameSize += Ping.GetFrameSize();
                break;

            case MessageId.PingOk:
                frameSize += PingOk.GetFrameSize();
                break;
            }

            //  Now serialize message into the buffer
            Msg msg = new Msg();

            msg.InitPool(frameSize);

            try
            {
                m_offset = 0;
                m_buffer = msg.Data;

                // put signature
                PutNumber2(0xAAA0 | 1);

                // put message id
                PutNumber1((byte)Id);

                switch (Id)
                {
                case MessageId.Hello:
                    Hello.Write(this);
                    break;

                case MessageId.Whisper:
                    Whisper.Write(this);
                    break;

                case MessageId.Shout:
                    Shout.Write(this);
                    break;

                case MessageId.Join:
                    Join.Write(this);
                    break;

                case MessageId.Leave:
                    Leave.Write(this);
                    break;

                case MessageId.Ping:
                    Ping.Write(this);
                    break;

                case MessageId.PingOk:
                    PingOk.Write(this);
                    break;
                }

                //  Send the data frame
                var more = Id == MessageId.Whisper || Id == MessageId.Shout;
                output.TrySend(ref msg, TimeSpan.Zero, more);

                // Send message content for types with content
                switch (Id)
                {
                case MessageId.Whisper:
                    if (Whisper.Content == null)
                    {
                        Whisper.Content = new NetMQMessage();
                        Whisper.Content.PushEmptyFrame();
                    }
                    output.TrySendMultipartMessage(Whisper.Content);
                    break;

                case MessageId.Shout:
                    if (Shout.Content == null)
                    {
                        Shout.Content = new NetMQMessage();
                        Shout.Content.PushEmptyFrame();
                    }
                    output.TrySendMultipartMessage(Shout.Content);
                    break;
                }
            }
            finally
            {
                m_buffer = null;
                msg.Close();
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Receive a ZreMsg from the socket.
        /// Message is ignored if the message signature doesn't start with %xAA %xA1 (returns false).
        /// It appears "real" input will always be a RouterSocket, but DealerSocket is used during unit testing by zeromq/zyre and by this implementation.
        /// </summary>
        /// <param name="input">the socket</param>
        /// <returns>true if successful</returns>
        public bool Receive(IReceivingSocket input)
        {
            if (input is RouterSocket)
            {
                Msg routingIdMsg = new Msg();
                routingIdMsg.InitEmpty();
                try
                {
                    input.Receive(ref routingIdMsg);

                    if (!routingIdMsg.HasMore)
                    {
                        throw new MessageException("No routing id");
                    }

                    if (_routingId == null || _routingId.Length == routingIdMsg.Size)
                    {
                        _routingId = new byte[routingIdMsg.Size];
                    }

                    Buffer.BlockCopy(routingIdMsg.Data, 0, _routingId, 0, _routingId.Length);
                }
                finally
                {
                    routingIdMsg.Close();
                }
            }
            else
            {
                RoutingId = null;
            }
            Msg msg = new Msg();

            msg.InitEmpty();

            try
            {
                input.Receive(ref msg);

                _offset = 0;
                _buffer = msg.Data;

                UInt16 signature = GetNumber2();

                if (signature != (0xAAA0 | 1))
                {
                    // spec:36 A node SHALL silently discard any message received that does not start with these two octets.
                    return(false);
                }

                //  Get message id and parse per message type
                Id = (MessageId)GetNumber1();

                switch (Id)
                {
                case MessageId.Hello:
                    Hello.Read(this);
                    break;

                case MessageId.Whisper:
                    Whisper.Read(this);
                    break;

                case MessageId.Shout:
                    Shout.Read(this);
                    break;

                case MessageId.Join:
                    Join.Read(this);
                    break;

                case MessageId.Leave:
                    Leave.Read(this);
                    break;

                case MessageId.Ping:
                    Ping.Read(this);
                    break;

                case MessageId.PingOk:
                    PingOk.Read(this);
                    break;

                default:
                    throw new MessageException("Bad message id");
                }

                // Receive message content for types with content
                switch (Id)
                {
                case MessageId.Whisper:
                    Whisper.Content = input.ReceiveMultipartMessage();
                    break;

                case MessageId.Shout:
                    Shout.Content = input.ReceiveMultipartMessage();
                    break;
                }
            }
            finally
            {
                _buffer = null;
                msg.Close();
            }
            return(true);
        }
Esempio n. 7
0
 public static bool Hook(ClientInfo _cInfo, string _message, string _playerName, string _secondaryName, bool _localizeSecondary)
 {
     if (!string.IsNullOrEmpty(_message) && _cInfo != null && _playerName != "Server" && _secondaryName != "ServerTools")
     {
         if (ChatFlood)
         {
             if (_message.Length > 500)
             {
                 _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Message to long.[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                 return(false);
             }
         }
         if (ChatLog.IsEnabled)
         {
             ChatLog.Log(_message, _playerName);
         }
         Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false];
         if (p != null)
         {
             if (p.IsMuted)
             {
                 _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, "You are muted.", "Server", false, "ServerTools", false));
                 return(false);
             }
         }
         if (AdminNameColoring && !_message.StartsWith("/") && !_message.StartsWith("@") && _secondaryName != "ServerTools1" && GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId))
         {
             AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId);
             if (Admin.PermissionLevel == AdminLevel)
             {
                 _playerName = string.Format("{0}{1} {2}[-]", AdminColor, AdminPrefix, _playerName);
                 GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, _message, _playerName, false, "ServerTools1", false);
                 return(false);
             }
             if (Admin.PermissionLevel == ModLevel)
             {
                 _playerName = string.Format("{0}{1} {2}[-]", ModColor, ModPrefix, _playerName);
                 GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, _message, _playerName, false, "ServerTools1", false);
                 return(false);
             }
         }
         if (Badwords.IsEnabled)
         {
             bool   _hasBadWord = false;
             string _message1   = _message.ToLower();
             foreach (string _word in Badwords.List)
             {
                 if (_message1.Contains(_word))
                 {
                     string _replace = "";
                     for (int i = 0; i < _word.Length; i++)
                     {
                         _replace = string.Format("{0}*", _replace);
                     }
                     _message1   = _message1.Replace(_word, _replace);
                     _hasBadWord = true;
                 }
             }
             if (_hasBadWord)
             {
                 GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, _message1, _playerName, false, "ServerTools", false);
                 return(false);
             }
         }
         if (_message.StartsWith("/") || _message.StartsWith("!"))
         {
             bool _announce = false;
             if (_message.StartsWith("!"))
             {
                 _announce = true;
                 _message  = _message.Replace("!", "");
             }
             if (_message.StartsWith("/"))
             {
                 _message = _message.Replace("/", "");
             }
             if (_message.StartsWith("w ") || _message.StartsWith("W ") || _message.StartsWith("pm ") || _message.StartsWith("PM "))
             {
                 if (CustomCommands.IsEnabled)
                 {
                     Whisper.Send(_cInfo, _message);
                     return(false);
                 }
             }
             if (_message.StartsWith("r ") || _message.StartsWith("R ") || _message.StartsWith("RE ") || _message.StartsWith("re "))
             {
                 if (CustomCommands.IsEnabled)
                 {
                     Whisper.Reply(_cInfo, _message);
                     return(false);
                 }
             }
             _message = _message.ToLower();
             if (_message.StartsWith("sethome"))
             {
                 if (_announce)
                 {
                     GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                 }
                 if (TeleportHome.IsEnabled)
                 {
                     TeleportHome.SetHome(_cInfo, _message);
                 }
                 else
                 {
                     _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Sethome is not enabled.[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                 }
                 return(false);
             }
             if (_message.StartsWith("home"))
             {
                 if (_announce)
                 {
                     GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                 }
                 if (TeleportHome.IsEnabled)
                 {
                     TeleportHome.TeleHome(_cInfo, _message);
                 }
                 else
                 {
                     _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Home is not enabled.[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                 }
                 return(false);
             }
             if (_message.StartsWith("listhomes"))
             {
                 if (_announce)
                 {
                     GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                 }
                 if (TeleportHome.IsEnabled)
                 {
                     TeleportHome.ListHomes(_cInfo);
                 }
                 else
                 {
                     _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Home is not enabled.[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                 }
                 return(false);
             }
             if (_message.StartsWith("delhome"))
             {
                 if (_announce)
                 {
                     GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                 }
                 if (TeleportHome.IsEnabled)
                 {
                     TeleportHome.RemoveHome(_cInfo, _message);
                 }
                 else
                 {
                     _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Home is not enabled.[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                 }
                 return(false);
             }
             if (AdminChat.IsEnabled)
             {
                 if (_message.StartsWith("mute ") || _message.StartsWith("unmute "))
                 {
                     if (_message.StartsWith("mute "))
                     {
                         MutePlayer.Add(_cInfo, _message);
                     }
                     if (_message.StartsWith("unmute "))
                     {
                         MutePlayer.Remove(_cInfo, _message);
                     }
                     return(false);
                 }
             }
             if (_message == "commands")
             {
                 string _commands = CustomCommands.GetChatCommands(_cInfo);
                 if (_announce)
                 {
                     GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                     GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, _commands, "Server", false, "ServerTools", false);
                 }
                 else
                 {
                     _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, _commands, "Server", false, "ServerTools", false));
                 }
                 return(false);
             }
             if (_message == "day7")
             {
                 if (Day7.IsEnabled)
                 {
                     if (_announce)
                     {
                         GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                     }
                     Day7.GetInfo(_cInfo, _announce);
                     return(false);
                 }
             }
             if (_message == "bloodmoon")
             {
                 if (Bloodmoon.IsEnabled)
                 {
                     if (_announce)
                     {
                         GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                     }
                     Bloodmoon.GetBloodmoon(_cInfo, _announce);
                     return(false);
                 }
             }
             if (_message == "killme" || _message == "wrist" || _message == "suicide")
             {
                 if (_announce)
                 {
                     GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                 }
                 if (KillMe.IsEnabled)
                 {
                     KillMe.CheckPlayer(_cInfo, _announce);
                 }
                 else
                 {
                     _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Killme is not enabled.[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                 }
                 return(false);
             }
             if (_message == "gimme" || _message == "gimmie")
             {
                 if (_announce)
                 {
                     GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                 }
                 if (Gimme.AlwaysShowResponse && !_announce)
                 {
                     GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("/{0}", _message), _playerName, false, "ServerTools", true);
                 }
                 if (Gimme.IsEnabled)
                 {
                     Gimme.Checkplayer(_cInfo, _announce, _playerName);
                 }
                 else
                 {
                     return(true);
                 }
                 return(false);
             }
             if (_message == "setjail" || _message.StartsWith("jail ") || _message.StartsWith("unjail "))
             {
                 if (Jail.IsEnabled)
                 {
                     if (_message == "setjail")
                     {
                         if (_announce)
                         {
                             GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                         }
                         Jail.SetJail(_cInfo);
                         return(false);
                     }
                     if (_message.StartsWith("jail "))
                     {
                         if (_announce)
                         {
                             GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                         }
                         Jail.PutInJail(_cInfo, _message);
                         return(false);
                     }
                     if (_message.StartsWith("unjail "))
                     {
                         if (_announce)
                         {
                             GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                         }
                         Jail.RemoveFromJail(_cInfo, _message);
                         return(false);
                     }
                 }
             }
             if (_message == "setspawn")
             {
                 if (NewSpawnTele.IsEnabled)
                 {
                     if (_announce)
                     {
                         GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                     }
                     NewSpawnTele.SetNewSpawnTele(_cInfo);
                     return(false);
                 }
             }
             if (_message.StartsWith("clanadd") || _message == "clandel" || _message.StartsWith("claninvite") || _message == "clanaccept" || _message == "clandecline" || _message.StartsWith("clanremove") || _message.StartsWith("clanpromote") || _message.StartsWith("clandemote") || _message.StartsWith("clan") || _message.StartsWith("c") || _message == "clancommands")
             {
                 if (ClanManager.IsEnabled)
                 {
                     if (_message == "clancommands")
                     {
                         ClanManager.GetChatCommands(_cInfo);
                         return(false);
                     }
                     if (_message.StartsWith("clanadd"))
                     {
                         if (_message == "clanadd")
                         {
                             _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Usage: /clanadd clanName[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                         }
                         else
                         {
                             _message = _message.Replace("clanadd ", "");
                             ClanManager.AddClan(_cInfo, _message);
                         }
                         return(false);
                     }
                     if (_message == "clandel")
                     {
                         ClanManager.RemoveClan(_cInfo);
                         return(false);
                     }
                     if (_message.StartsWith("claninvite"))
                     {
                         if (_message == "claninvite")
                         {
                             _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Usage: /claninvite playerName[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                         }
                         else
                         {
                             _message = _message.Replace("claninvite ", "");
                             ClanManager.InviteMember(_cInfo, _message);
                         }
                         return(false);
                     }
                     if (_message == "clanaccept")
                     {
                         ClanManager.InviteAccept(_cInfo);
                         return(false);
                     }
                     if (_message == "clandecline")
                     {
                         ClanManager.InviteDecline(_cInfo);
                         return(false);
                     }
                     if (_message.StartsWith("clanremove"))
                     {
                         if (_message == "clanremove")
                         {
                             _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Usage: /clanremove playerName[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                         }
                         else
                         {
                             _message = _message.Replace("clanremove ", "");
                             ClanManager.RemoveMember(_cInfo, _message);
                         }
                         return(false);
                     }
                     if (_message.StartsWith("clanpromote"))
                     {
                         if (_message == "clanpromote")
                         {
                             _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Usage: /clanpromote playerName[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                         }
                         else
                         {
                             _message = _message.Replace("clanpromote ", "");
                             ClanManager.PromoteMember(_cInfo, _message);
                         }
                         return(false);
                     }
                     if (_message.StartsWith("clandemote"))
                     {
                         if (_message == "clandemote")
                         {
                             _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Usage: /clandemote playerName[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                         }
                         else
                         {
                             _message = _message.Replace("clandemote ", "");
                             ClanManager.DemoteMember(_cInfo, _message);
                         }
                         return(false);
                     }
                     if (_message == "clanleave")
                     {
                         ClanManager.LeaveClan(_cInfo);
                         return(false);
                     }
                     if (_message.StartsWith("clan"))
                     {
                         if (_message == "clan")
                         {
                             _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Usage: /clan message[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                         }
                         else
                         {
                             _message = _message.Replace("clan ", "");
                             ClanManager.Clan(_cInfo, _message);
                         }
                         return(false);
                     }
                     if (_message.StartsWith("c"))
                     {
                         if (_message == "c")
                         {
                             _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Usage: /c message[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                         }
                         else
                         {
                             _message = _message.Replace("c ", "");
                             ClanManager.Clan(_cInfo, _message);
                         }
                         return(false);
                     }
                 }
                 else
                 {
                     return(true);
                 }
             }
             if (CustomCommands.IsEnabled && CustomCommands.Dict.Count > 0 && CustomCommands.Dict.ContainsKey(_message))
             {
                 string[] _r;
                 if (CustomCommands.Dict.TryGetValue(_message, out _r))
                 {
                     string _response = _r[0];
                     _response = _response.Replace("{EntityId}", _cInfo.entityId.ToString());
                     _response = _response.Replace("{SteamId}", _cInfo.playerId);
                     _response = _response.Replace("{PlayerName}", _playerName);
                     if (_announce)
                     {
                         GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "ServerTools", true);
                     }
                     if (_response.StartsWith("say "))
                     {
                         if (_announce)
                         {
                             SdtdConsole.Instance.ExecuteSync(_response, _cInfo);
                         }
                         else
                         {
                             _response = _response.Replace("say ", "");
                             _response = _response.Replace("\"", "");
                             _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format(_response), "Server", false, "ServerTools", false));
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.ExecuteSync(_response, _cInfo);
                     }
                 }
                 return(false);
             }
         }
         if (_message.StartsWith("@"))
         {
             if (_message.StartsWith("@admins ") || _message.StartsWith("@ADMINS "))
             {
                 if (!AdminChat.IsEnabled)
                 {
                     _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}AdminChat is not enabled.[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                 }
                 else
                 {
                     AdminChat.SendAdmins(_cInfo, _message);
                 }
                 return(false);
             }
             if (_message.StartsWith("@all ") || _message.StartsWith("@ALL "))
             {
                 if (!AdminChat.IsEnabled)
                 {
                     _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}AdminChat is not enabled.[-]", CustomCommands.ChatColor), "Server", false, "ServerTools", false));
                 }
                 else
                 {
                     AdminChat.SendAll(_cInfo, _message);
                 }
                 return(false);
             }
         }
     }
     return(true);
 }