Search in sources :

Example 1 with ValuableBlock

use of com.iridium.iridiumskyblock.configs.BlockValues.ValuableBlock in project IridiumSkyblock by Iridium-Development.

the class BlockValueGUI method addContent.

@Override
public void addContent(Inventory inventory) {
    inventory.clear();
    InventoryUtils.fillInventory(inventory, getNoItemGUI().background);
    inventory.setItem(inventory.getSize() - 3, ItemStackUtils.makeItem(IridiumSkyblock.getInstance().getInventories().nextPage));
    inventory.setItem(inventory.getSize() - 7, ItemStackUtils.makeItem(IridiumSkyblock.getInstance().getInventories().previousPage));
    if (guiType == BlockValueType.BLOCK) {
        IridiumSkyblock.getInstance().getBlockValues().blockValues.entrySet().stream().filter(valuableBlockEntry -> (page == 1 ? valuableBlockEntry.getValue().page <= 1 : valuableBlockEntry.getValue().page == page)).forEachOrdered(valuableBlock -> {
            XMaterial material = valuableBlock.getKey();
            ValuableBlock blockInfo = valuableBlock.getValue();
            ItemStack blockItem = ItemStackUtils.makeItem(material, 1, StringUtils.color(blockInfo.name), getColoredValueLore(blockInfo.value));
            inventory.setItem(blockInfo.slot, blockItem);
        });
    } else if (guiType == BlockValueType.SPAWNER) {
        IridiumSkyblock.getInstance().getBlockValues().spawnerValues.entrySet().stream().filter(valuableSpawnerEntry -> (page == 1 ? valuableSpawnerEntry.getValue().page <= 1 : valuableSpawnerEntry.getValue().page == page)).forEachOrdered(valuableSpawner -> {
            ValuableBlock spawnerInfo = valuableSpawner.getValue();
            ItemStack spawnerItem = ItemStackUtils.makeItem(XMaterial.SPAWNER, 1, StringUtils.color(spawnerInfo.name), getColoredValueLore(spawnerInfo.value));
            inventory.setItem(spawnerInfo.slot, spawnerItem);
        });
    }
    if (IridiumSkyblock.getInstance().getConfiguration().backButtons && getPreviousInventory() != null) {
        inventory.setItem(inventory.getSize() + IridiumSkyblock.getInstance().getInventories().backButton.slot, ItemStackUtils.makeItem(IridiumSkyblock.getInstance().getInventories().backButton));
    }
}
Also used : Arrays(java.util.Arrays) ItemStackUtils(com.iridium.iridiumcore.utils.ItemStackUtils) InventoryClickEvent(org.bukkit.event.inventory.InventoryClickEvent) Player(org.bukkit.entity.Player) Collectors(java.util.stream.Collectors) Inventory(org.bukkit.inventory.Inventory) XMaterial(com.iridium.iridiumcore.dependencies.xseries.XMaterial) StringUtils(com.iridium.iridiumcore.utils.StringUtils) ItemStack(org.bukkit.inventory.ItemStack) ValuableBlock(com.iridium.iridiumskyblock.configs.BlockValues.ValuableBlock) List(java.util.List) InventoryUtils(com.iridium.iridiumcore.utils.InventoryUtils) IridiumSkyblock(com.iridium.iridiumskyblock.IridiumSkyblock) XMaterial(com.iridium.iridiumcore.dependencies.xseries.XMaterial) ItemStack(org.bukkit.inventory.ItemStack) ValuableBlock(com.iridium.iridiumskyblock.configs.BlockValues.ValuableBlock)

Aggregations

XMaterial (com.iridium.iridiumcore.dependencies.xseries.XMaterial)1 InventoryUtils (com.iridium.iridiumcore.utils.InventoryUtils)1 ItemStackUtils (com.iridium.iridiumcore.utils.ItemStackUtils)1 StringUtils (com.iridium.iridiumcore.utils.StringUtils)1 IridiumSkyblock (com.iridium.iridiumskyblock.IridiumSkyblock)1 ValuableBlock (com.iridium.iridiumskyblock.configs.BlockValues.ValuableBlock)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Player (org.bukkit.entity.Player)1 InventoryClickEvent (org.bukkit.event.inventory.InventoryClickEvent)1 Inventory (org.bukkit.inventory.Inventory)1 ItemStack (org.bukkit.inventory.ItemStack)1