@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);
}
我有一个问题,关闭库存甚至没有悄悄地工作。谁有更好的解决方案或解决方案?
1条答案
按热度按时间qvsjd97n1#
是
onInteraction
工作?尝试添加@EventHandler
到onCloseInventory
方法。