package net.crankedpvp.slotbot; import de.tr7zw.nbtapi.NBTItem; import net.crankedpvp.crankedutils.utils.CustomItemUtils; import net.crankedpvp.crankedutils.utils.items.ItemUtils; import net.crankedpvp.loottable.LootTableAPI; import net.crankedpvp.loottable.struct.LootTableType; import net.crankedpvp.slotbot.struct.SlotBotType; import org.bukkit.inventory.ItemStack; import java.util.List; public class SlotBotAPI { public static boolean isSlotBot(final ItemStack itemStack) { return CustomItemUtils.getCrankedCustomItem(itemStack).equals("slotBotTicket"); } public static SlotBotType getSlotBotType(ItemStack itemStack) { if(ItemUtils.isAirOrNull(itemStack)) return null; if(!isSlotBot(itemStack)) return null; NBTItem nbtItem = new NBTItem(itemStack); if (nbtItem.getString("slotBotType") == null) return SlotBotType.SLOT_BOT; if (nbtItem.getString("slotBotType").equals("")) return SlotBotType.SLOT_BOT; return SlotBotType.valueOf(nbtItem.getString("slotBotType")); } public static List getRewards() { return LootTableAPI.getAllLootFromLootTable(LootTableType.SLOTBOT); } }