Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.40 KB | None | 0 0
  1. @Data
  2. @AllArgsConstructor
  3. public class ItemCase {
  4.     public static final NamespacedKey CHEST_TYPE_KEY = new NamespacedKey(CashCases.getCashCases(), "chestType");
  5.     private static final List<Pair<CaseType, ItemCase>> caseList = new ArrayList<>();
  6.  
  7.     static {
  8.         Collection<Pair<ItemStack, Double>> bigCaseItems = new HashSet<>();
  9.         bigCaseItems.add(new Pair<>(new ItemStack(Material.PAPER), 5D));
  10.         ItemCase bigItemCase = new ItemCase(CaseType.BIG, 3, ChatColor.translateAlternateColorCodes('&', "&6Duża Skrzynia"), new ArrayList<>(), bigCaseItems);
  11.         caseList.add(new Pair<>(CaseType.BIG, bigItemCase));
  12.     }
  13.  
  14.     private CaseType caseType;
  15.     private int rollRows;
  16.     private String displayName;
  17.     private List<String> lore;
  18.     private Collection<Pair<ItemStack, Double>> rewards;
  19.  
  20.     public ItemStack toItemStack() {
  21.         ItemStack result = new ItemStack(Material.CHEST, 1);
  22.         ItemMeta resultItemMeta = result.getItemMeta();
  23.         resultItemMeta.setDisplayName(this.getDisplayName());
  24.         this.getLore().add(0, ChatColor.translateAlternateColorCodes('&', "&6Z tej skrzyni możesz wylosować:"));
  25.         resultItemMeta.setLore(this.getLore());
  26.         result.getItemMeta().getPersistentDataContainer().set(CHEST_TYPE_KEY, PersistentDataType.STRING, getCaseType().toString());
  27.         result.setItemMeta(resultItemMeta);
  28.         return result;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement