コード例 #1
0
        private void TakeAction(IPlayer player, string action, string reason)
        {
            switch (action)
            {
            case "ban":
                player.Ban(reason);
                break;

            case "kick":
                player.Kick(reason);
                break;

            case "kill":
                player.Kill();
                break;

            case "slap":
                if (Slap)
                {
                    Slap.Call("SlapPlayer", player);
                }
                else
                {
                    PrintWarning("Slap plugin is not installed; slap action will not work");
                }
                break;
            }
        }
コード例 #2
0
        private string TakeAction(IPlayer player, string text, string[] list, string action, string reason)
        {
            if (string.IsNullOrEmpty(action))
            {
                return(string.Empty);
            }

            switch (action.ToLower().Trim())
            {
            case "ban":
                player.Ban(reason);
                return(string.Empty);

            case "censor":
                foreach (string word in list)
                {
                    text = text.Replace(word, config.CensorText.Length == 1 ? new string(config.CensorText[0], word.Length) : config.CensorText);
                }
                return(text);

            case "kick":
                player.Kick(reason);
                return(string.Empty);

            case "kill":
                player.Kill();
                return(string.Empty);

            case "slap":
                if (Slap)
                {
                    Slap.Call("SlapPlayer", player);
                }
                else
                {
                    LogWarning("Slap plugin is not installed; slap action will not work");
                }
                return(string.Empty);

            default:
                return(string.Empty);
            }
        }