Skip to content

关于 TabooLib 2.0.38 执行原生Kether语句报错 #728

Closed

Description

@BalanceSea

问题描述

使用TabooLib 2.0.38版本执行原生语句 tell,sound 等出现报错 切换到2.0.37后可以正常执行kether语句

Gradle配置

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import io.izzel.taboolib.gradle.*
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
import io.izzel.taboolib.gradle.Basic
import io.izzel.taboolib.gradle.BukkitUI
import io.izzel.taboolib.gradle.BukkitHook
import io.izzel.taboolib.gradle.Bukkit


plugins {
    java
    id("io.izzel.taboolib") version "2.0.38"
    id("org.jetbrains.kotlin.jvm") version "2.2.0"
}

taboolib {
    env {
        install(Basic)
        install(BukkitUI)
        install(BukkitHook)
        install(Bukkit)
        install(Kether)
        install(CommandHelper)
    }
    description {
        name = "CloudProfile"
        desc("查看玩家个人档案")
        contributors {
            name("BalanceSea")
        }
        dependencies {
            name("PlaceholderAPI").optional(true)
        }
    }
    version { taboolib = "6.3.0-75b18a2" }
}

repositories {
    mavenCentral()
}

dependencies {
    compileOnly("ink.ptms.core:v12004:12004:mapped")
    compileOnly("ink.ptms.core:v12004:12004:universal")
    compileOnly(kotlin("stdlib"))
    compileOnly(fileTree("libs"))
}

tasks.withType<JavaCompile> {
    options.encoding = "UTF-8"
}

tasks.withType<KotlinCompile> {
    compilerOptions {
        jvmTarget.set(JVM_1_8)
        freeCompilerArgs.add("-Xjvm-default=all")
    }
}

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

复现代码

/**
     * 执行Kether脚本
     */
    fun execute(player: Player,ketherList: List<String>){
        //info("执行 $ketherList")
        KetherShell.eval(
            //source = ketherList,
            source = "tell 'Kether Test'",
            options = ScriptOptions.new {
                sender(player)
            }
        ).join()
    }

报错日志

https://mclo.gs/GFXIbSv

[04:31:15 WARN]: com.cloudworld.cloudprofile.taboolib.library.kether.LocalizedException: Isolate literal "tell" is not end of block, maybe a misspelled action?
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.library.kether.LocalizedException.of(LocalizedException.java:55)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.module.kether.KetherError.create(KetherError.kt:11)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.library.kether.BlockReader.checkLiteral(BlockReader.java:58)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.library.kether.BlockReader.readBlock(BlockReader.java:47)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.library.kether.BlockReader.parse(BlockReader.java:36)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.library.kether.SimpleQuestLoader.load(SimpleQuestLoader.java:18)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.module.kether.KetherHelperKt.parseKetherScript(KetherHelper.kt:45)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.module.kether.KetherShell$eval$script$1.invoke(KetherShell.kt:55)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.module.kether.KetherShell$eval$script$1.invoke(KetherShell.kt:54)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.module.kether.KetherShell.eval$lambda$0(KetherShell.kt:54)
[04:31:15 WARN]:        at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1724)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.module.kether.KetherShell.eval(KetherShell.kt:54)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.module.kether.KetherShell.eval$process(KetherShell.kt:16)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.module.kether.KetherShell.eval(KetherShell.kt:17)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.utils.ProfileKetherExecuter.execute(ProfileKetherExecuter.kt:16)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.gui.ProfileGUI.openProfileMenu$lambda$3$lambda$2(ProfileGUI.kt:50)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.module.ui.type.impl.ChestImpl$onClick$2.invoke(ChestImpl.kt:192)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.module.ui.type.impl.ChestImpl$onClick$2.invoke(ChestImpl.kt:187)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.module.ui.ClickListener.onClick(ClickListener.kt:73)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.library.reflex.JavaClassMethod.invoke(JavaClassMethod.kt:61)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.common.platform.event.EventBus.invoke(EventBus.kt:161)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.common.platform.event.EventBus.invoke$default(EventBus.kt:159)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.common.platform.event.EventBus$registerBukkit$2.invoke(EventBus.kt:88)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.common.platform.event.EventBus$registerBukkit$2.invoke(EventBus.kt:88)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.common.platform.function.ListenerKt$registerBukkitListener$1.invoke(Listener.kt:37)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.common.platform.function.ListenerKt$registerBukkitListener$1.invoke(Listener.kt:37)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.platform.BukkitListener$registerListener$listener$1.invoke(BukkitListener.kt:36)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.platform.BukkitListener$registerListener$listener$1.invoke(BukkitListener.kt:36)
[04:31:15 WARN]:        at CloudProfile-1.0.0-SNAPSHOT.jar//com.cloudworld.cloudprofile.taboolib.platform.BukkitListener$BukkitListener.execute(BukkitListener.kt:57)
[04:31:15 WARN]:        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:71)
[04:31:15 WARN]:        at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:60)
[04:31:15 WARN]:        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131)
[04:31:15 WARN]:        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:629)
[04:31:15 WARN]:        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleContainerClick(ServerGamePacketListenerImpl.java:3430)
[04:31:15 WARN]:        at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:59)
[04:31:15 WARN]:        at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:14)
[04:31:15 WARN]:        at net.minecraft.network.PacketProcessor$ListenerAndPacket.handle(PacketProcessor.java:99)
[04:31:15 WARN]:        at net.minecraft.network.PacketProcessor.executeSinglePacket(PacketProcessor.java:33)
[04:31:15 WARN]:        at net.minecraft.server.MinecraftServer.runAllTasksAtTickStart(MinecraftServer.java:1252)
[04:31:15 WARN]:        at net.minecraft.server.MinecraftServer.processPacketsAndTick(MinecraftServer.java:1769)
[04:31:15 WARN]:        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1435)
[04:31:15 WARN]:        at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:430)
[04:31:15 WARN]:        at java.base/java.lang.Thread.run(Thread.java:1474)

Activity

  1. FxRayHughes commented on Aug 14, 2026

    @FxRayHughes
    Contributor

    从日志和当前实现看,你的调用方式没有问题:

    KetherShell.eval(
        "tell 'Kether Test'",
        ScriptOptions.new {
            sender(player)
        }
    )

    这里也不需要额外设置 namespace。

    请先关闭服务端,删除服务端根目录下的 cache/taboolib 缓存目录,然后重新启动服务端并再次测试。该目录保存的是 TabooLib 模块重定向后的缓存,重启时会自动重新生成。

    如果清理服务端缓存后仍能稳定复现,再继续按下面的方向排查。

    这个异常发生在脚本解析阶段,含义是 tell 没有被注册为 Kether 动作,并不是 tell 'Kether Test' 的语法错误。tell 和 sound 恰好都定义在 minecraft-kether 的同一个内置动作对象中,因此二者同时失效也符合“内置动作未完成注册”的表现。

    对比 Gradle 插件 2.0.37...2.0.38 后,2.0.38 唯一的实质变化是将内嵌 ASM 从 9.7.1 升级到 9.9。结合你回退 2.0.37 后恢复正常,目前更倾向于是 2.0.38 在处理 Kotlin 2.2.0 产物时引入的打包/重定位回归,而不是 Kether API 的用法变化。

    若清理服务端缓存无效,目前可以先继续使用 Gradle 插件 2.0.37 作为临时规避方案。为了进一步确认具体损坏发生在哪一步,麻烦再提供:

    1. ./gradlew --version 的输出;
    2. 使用 2.0.38 生成的最终插件 JAR(或一个可复现的最小项目);
    3. 服务端从启动到插件加载完成的完整日志(当前 mclo.gs 只有触发异常时的堆栈)。

    拿到最终 JAR 后可以直接核对 Actions 类及其 @Inject / @KetherParser 元数据是否在重定位过程中被破坏。

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