-
-
Save FilipDev/8cf3e58d1e9669ed98d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Inventory generateInventory(Player player) { | |
Inventory inventory; | |
if (size == 5) { | |
inventory = Bukkit.createInventory(null, InventoryType.HOPPER, name + inventoryID.getId()); | |
} | |
else { | |
inventory = Bukkit.createInventory(null, size, name + inventoryID.getId()); | |
} | |
ItemStack[] itemStacks = new ItemStack[size]; | |
elementMap.entrySet().forEach(entry -> { | |
int i = entry.getKey().toSlot(); | |
if (entry.getValue() instanceof ToggleableElement) { | |
ToggleableElement toggleableElement = (ToggleableElement) entry.getValue(); | |
toggleableElement.testPredicate(CorePlayer.get(player), inventory); | |
} | |
itemStacks[i] = entry.getValue().getRepresentation(); | |
}); | |
inventory.setContents(itemStacks); | |
System.out.println(Arrays.toString(itemStacks)); | |
System.out.println(Arrays.toString(inventory.getContents())); | |
return inventory; | |
} | |
[21:41:34 INFO]: [ItemStack{CARROT x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}] | |
[21:41:34 INFO]: [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment