broken-arrow

Untitled

May 28th, 2021 (edited)
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1.     public void setContents(int size, String title, Location location) {
  2.         ArrayList<Inventory> inventories = this.openedInventoriesTest.get(location);
  3.         ChestRegistry registry = ChestRegistry.getInstance();
  4.         Map<Location, ItemStack[]> ItemStack = registry.getcontents();
  5.         org.bukkit.inventory.ItemStack[] itemStacks = ItemStack.get(location);
  6.         List<ItemStack[]> testing = new ArrayList<>();
  7.  
  8.         testing.add(itemStacks);
  9.         String CountItems = Arrays.toString(testing.get(0));
  10.         ItemStack[] itemStacks1 = testing.get(0);
  11.         String[] inputSplited;
  12.         if (itemStacks1 == null)
  13.             itemStacks1 = new ItemStack[0];
  14.  
  15.         int length = CountItems.split(",").length;
  16.  
  17.         int currentInventory = 0;
  18.         //System.out.println("Itemstacks before" + Arrays.toString(itemStacks1));
  19.         do {
  20.             for (int i = 0; i < length; i++) {
  21.                 Inventory inventory = getPage(currentInventory, location);
  22.                 //String inputs = inputSplited[i];
  23.                 if (i < GuiSize) {
  24.                     //inventory.setContents(new ItemStack[]{(itemStacks1[i] != null ? itemStacks1[i] : new ItemStack(Material.AIR))});
  25.                     inventory.setItem(i, itemStacks1[i]);
  26.                     System.out.println("itemstack " + itemStacks1[i] + "value i = " + i);
  27.                
  28.                 }
  29.             }
  30.             currentInventory++;
  31.         } while (currentInventory < getPageIndex);
  32.  
  33.     }
Add Comment
Please, Sign In to add comment