Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Liangbai2333 opened this issue Aug 17, 2024 · 1 comment
Open

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

Liangbai2333 opened this issue Aug 17, 2024 · 1 comment

Comments

@Liangbai2333
Copy link
Contributor

Liangbai2333 commented Aug 17, 2024

在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
Copy link
Collaborator

Bkm016 commented Aug 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants