+ fix some bug

This commit is contained in:
sky 2019-12-11 17:41:19 +08:00
parent 962bfa5256
commit e6c7e8cbed
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,8 @@
package io.izzel.taboolib.module.nms.nbt; package io.izzel.taboolib.module.nms.nbt;
import com.google.common.collect.Maps; 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.Collection;
import java.util.Map; import java.util.Map;
@ -24,6 +26,10 @@ public class NBTCompound extends NBTBase implements Map<String, NBTBase> {
this.data = this; this.data = this;
} }
public void saveTo(ItemStack item) {
item.setItemMeta(NMS.handle().saveNBT(item, this).getItemMeta());
}
@Override @Override
public int size() { public int size() {
return value.size(); return value.size();

View File

@ -36,8 +36,8 @@ class ClickListener implements Listener {
@EventHandler @EventHandler
public void e(InventoryOpenEvent e) { public void e(InventoryOpenEvent e) {
if (e.getInventory().getHolder() instanceof MenuHolder) { if (e.getInventory().getHolder() instanceof MenuHolder) {
Bukkit.getScheduler().runTask(TabooLib.getPlugin(), () -> ((MenuHolder) e.getInventory().getHolder()).getBuilder().getBuildTask().run(e.getInventory())); Bukkit.getScheduler().runTaskLater(TabooLib.getPlugin(), () -> ((MenuHolder) e.getInventory().getHolder()).getBuilder().getBuildTask().run(e.getInventory()), 1);
Bukkit.getScheduler().runTaskAsynchronously(TabooLib.getPlugin(), () -> ((MenuHolder) e.getInventory().getHolder()).getBuilder().getBuildTaskAsync().run(e.getInventory())); Bukkit.getScheduler().runTaskLaterAsynchronously(TabooLib.getPlugin(), () -> ((MenuHolder) e.getInventory().getHolder()).getBuilder().getBuildTaskAsync().run(e.getInventory()), 1);
} }
} }