コード例 #1
0
ファイル: RPCHooks.cs プロジェクト: SuperKael/Gadget-Core
        internal void RPCSendConsoleMessage(string message, NetworkMessageInfo info)
        {
            if (string.IsNullOrEmpty(message))
            {
                return;
            }
            if (message.Length > 1 && message[0] == '/')
            {
                string command = GadgetConsole.ParseArgs(message.Substring(1))[0];
                if (GadgetConsole.IsCommandExecuteBlacklisted(command))
                {
                    GadgetConsole.Print($"{GadgetNetwork.GetNameByNetworkPlayer(info.sender) ?? GadgetCoreAPI.GetPlayerName()} attempted to force you to execute the blacklisted command: {message}", null, GadgetConsole.MessageSeverity.WARN);
                    return;
                }
            }
            bool isOperator = GadgetConsole.IsOperator(GadgetCoreAPI.GetPlayerName());

            if (isOperator)
            {
                if (message.Length > 1 && message[0] == '/')
                {
                    GadgetConsole.Print($"{GadgetNetwork.GetNameByNetworkPlayer(info.sender) ?? GadgetCoreAPI.GetPlayerName()} forced you to execute the command: {message}");
                }
                else
                {
                    GadgetConsole.Print($"{GadgetNetwork.GetNameByNetworkPlayer(info.sender) ?? GadgetCoreAPI.GetPlayerName()} forced you to say: {message}");
                }
            }
            GadgetConsole.SendConsoleMessage(message, GadgetCoreAPI.GetPlayerName(), isOperator, true);
        }