Skip to content

新解析器参数解析不一致问题 #697

Closed

Description

@zzzyyylllty
    /** Kether */
    @CommandBody
    val eval = subCommand {
        dynamic("script") {
            execute<CommandSender> { sender, context, argument ->
                submitAsync {
                    // 获取参数的值
                    val content = context["script"]
                    val ret = runKether(listOf(content), sender)
                    sender.sendStringAsComponent(sender.asLangText("ApiKether", content))
                    sender.sendStringAsComponent(sender.asLangText("ApiReturn", ret.get().toString())) }
            }
        }
    }

上述这段代码开启、关闭新解析器将导致结尾的参数不同解析结果:

/kangeldungeon api eval tell 1

newParser = false时 结果如下:(结尾参数无限解析)

argument= tell 1,context["script"]= tell 1

newParser = true时 结果如下:(结尾参数只解析1个)

argument= tell,context["script"]= tell


值得注意的是newParser看的是执行的指令,

如/kangeldungeon开启解析,/kangeldungeonapi关闭解析,但是/kangeldungeon api嵌套仍然视作开启解析。刚开始我被这个东西扰乱了

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions