Files
Project-CrankedPvP/SlotBot/src/main/java/net/crankedpvp/slotbot/SlotBotAPI.java
T
2026-10-12 13:57:05 -03:00

33 lines
1.2 KiB
Java

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<ItemStack> getRewards() {
return LootTableAPI.getAllLootFromLootTable(LootTableType.SLOTBOT);
}
}