コード例 #1
0
ファイル: Actions.cs プロジェクト: fcraft-based/GemsCraft
        public static string RunCommand(PlayerInfo player, string command, string[] args)
        {
            try
            {
                if (command == null)
                {
                    return("");
                }
                CommandDescriptor cd = CommandManager.GetDescriptor(command, true);
                if (cd != null && cd.Permissions.Any(p => !player.Can(p)))
                {
                    return("Player does not have this permission.");
                }

                cd?.Call(Player.Console, new Command(CommandString(command, args)), true);

                return("");
            }
            catch (Exception e)
            {
                return("Command does not exist");
            }
        }