Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.yourPackage;
- import java.util.ArrayList;
- import org.bukkit.Color;
- import org.bukkit.Material;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.inventory.meta.LeatherArmorMeta;
- public class ItBuilder {
- public static ItemStack get(Material material) {
- ItemStack it = new ItemStack(material);
- return it;
- }
- public static ItemStack createVerySimple(Material material, String nome, short data) {
- ItemStack it = new ItemStack(material, 1, (short) data);
- ItemMeta itM = it.getItemMeta();
- itM.setDisplayName(nome);
- it.setItemMeta(itM);
- return it;
- }
- public static ItemStack createVerySimple(Material material, String nome) {
- ItemStack it = new ItemStack(material);
- ItemMeta itM = it.getItemMeta();
- itM.setDisplayName(nome);
- it.setItemMeta(itM);
- return it;
- }
- public static ItemStack createVerySimple(Material material, String nome, int amount) {
- ItemStack it = new ItemStack(material, amount);
- ItemMeta itM = it.getItemMeta();
- itM.setDisplayName(nome);
- it.setItemMeta(itM);
- return it;
- }
- public static ItemStack createVerySimple(Material material, String nome, short data, int amount) {
- ItemStack it = new ItemStack(material, amount, (short) data);
- ItemMeta itM = it.getItemMeta();
- itM.setDisplayName(nome);
- it.setItemMeta(itM);
- return it;
- }
- public static ItemStack createSimple(Material material, String nome, ArrayList<String> lore) {
- ItemStack it = new ItemStack(material);
- ItemMeta itM = it.getItemMeta();
- itM.setDisplayName(nome);
- itM.setLore(lore);
- it.setItemMeta(itM);
- return it;
- }
- public static ItemStack createAdvanced(Material material, String nome, ArrayList<String> lore, int amount, short data) {
- ItemStack it = new ItemStack(material, amount, (short) data);
- ItemMeta itM = it.getItemMeta();
- itM.setDisplayName(nome);
- itM.setLore(lore);
- it.setItemMeta(itM);
- return it;
- }
- public static ItemStack createLeatherArmor(Material material, short damage, String nome, ArrayList<String> lore, int amount, Color cor) {
- ItemStack it = new ItemStack(material, (int) amount, (short) damage);
- LeatherArmorMeta itM = (LeatherArmorMeta) it.getItemMeta();
- itM.setDisplayName(nome);
- itM.setLore(lore);
- itM.setColor(cor);
- it.setItemMeta(itM);
- return it;
- }
- @SuppressWarnings("deprecation")
- public static boolean areEquals(ItemStack item, ItemStack item2) {
- boolean equals;
- if (item.getTypeId() == item2.getTypeId() && item.getItemMeta().getDisplayName().equals(item.getItemMeta().getDisplayName()) && item.getItemMeta().getLore().equals(item2.getItemMeta().getLore()) && item.getEnchantments().equals(item2.getEnchantments())) {
- equals = true;
- } else {
- equals = false;
- }
- return equals;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement