diff --git a/src/main/scala/io/izzel/taboolib/module/nms/nbt/NBTCompound.java b/src/main/scala/io/izzel/taboolib/module/nms/nbt/NBTCompound.java index 8d3adbc..2efefc6 100644 --- a/src/main/scala/io/izzel/taboolib/module/nms/nbt/NBTCompound.java +++ b/src/main/scala/io/izzel/taboolib/module/nms/nbt/NBTCompound.java @@ -1,6 +1,8 @@ package io.izzel.taboolib.module.nms.nbt; import com.google.common.collect.Maps; +import io.izzel.taboolib.module.nms.NMS; +import org.bukkit.inventory.ItemStack; import java.util.Collection; import java.util.Map; @@ -24,6 +26,10 @@ public class NBTCompound extends NBTBase implements Map { this.data = this; } + public void saveTo(ItemStack item) { + item.setItemMeta(NMS.handle().saveNBT(item, this).getItemMeta()); + } + @Override public int size() { return value.size(); diff --git a/src/main/scala/io/izzel/taboolib/util/item/inventory/ClickListener.java b/src/main/scala/io/izzel/taboolib/util/item/inventory/ClickListener.java index 529bee5..a6166bb 100644 --- a/src/main/scala/io/izzel/taboolib/util/item/inventory/ClickListener.java +++ b/src/main/scala/io/izzel/taboolib/util/item/inventory/ClickListener.java @@ -36,8 +36,8 @@ class ClickListener implements Listener { @EventHandler public void e(InventoryOpenEvent e) { if (e.getInventory().getHolder() instanceof MenuHolder) { - Bukkit.getScheduler().runTask(TabooLib.getPlugin(), () -> ((MenuHolder) e.getInventory().getHolder()).getBuilder().getBuildTask().run(e.getInventory())); - Bukkit.getScheduler().runTaskAsynchronously(TabooLib.getPlugin(), () -> ((MenuHolder) e.getInventory().getHolder()).getBuilder().getBuildTaskAsync().run(e.getInventory())); + Bukkit.getScheduler().runTaskLater(TabooLib.getPlugin(), () -> ((MenuHolder) e.getInventory().getHolder()).getBuilder().getBuildTask().run(e.getInventory()), 1); + Bukkit.getScheduler().runTaskLaterAsynchronously(TabooLib.getPlugin(), () -> ((MenuHolder) e.getInventory().getHolder()).getBuilder().getBuildTaskAsync().run(e.getInventory()), 1); } }