TabooLib / taboolib

Powerful framework for creating multi-platform Minecraft plugin
https://tabooproject.org
MIT License
313 stars 100 forks source link

UI模块,buildCallback回调不即时 #445

Open Liangbai2333 opened 3 months ago

Liangbai2333 commented 3 months ago

在ClickListener的onOpen中:

fun onOpen(e: InventoryOpenEvent) {
        val builder = MenuHolder.fromInventory(e.inventory) as? ChestImpl ?: return
        // 构建回调
        submit {
            builder.buildCallback(e.player as Player, e.inventory)
            builder.selfBuildCallback(e.player as Player, e.inventory)
        }
    }

处理回调是用的submit {},但是这样做会让回调任务在下一个tick才能执行,其他插件无法在InventoryOpenEvent事件中监听到容器内容。作为同步回调,这样是否不太妥当,如果能改成submit(now = true)会更好 而且这个优先级似乎可以高一些?

Bkm016 commented 3 months ago

已经忘记了当时为什么要这么写了