minecraft插口与closeinventory有问题

fgw7neuy  于 2021-07-03  发布在  Java
关注(0)|答案(1)|浏览(375)
@EventHandler
    public void onInteraction(PlayerInteractEvent event) {
        Player player = (Player) event.getPlayer();
       int id = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(FriendsGUI.getInstance(), new Runnable() {

            @Override
            public void run() {
                player.sendMessage("Hello " + player.getName());
            }
        }, 0, 20);
    }
    public void onCloseInventory(InventoryCloseEvent event){
        Player player = (Player) event.getPlayer();
        player.sendMessage("lul");
        Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(FriendsGUI.getInstance(), new Runnable() {

            @Override
            public void run() {
                player.sendMessage("Goodbye  " + player.getName());
                Bukkit.getScheduler().cancelAllTasks();

            }
        }, 0);
    }

我有一个问题,关闭库存甚至没有悄悄地工作。谁有更好的解决方案或解决方案?

qvsjd97n

qvsjd97n1#

onInteraction 工作?尝试添加 @EventHandleronCloseInventory 方法。

相关问题