use of com.iridium.iridiumskyblock.Upgrade in project IridiumSkyblock by Iridium-Development.
the class IslandUpgradesGUI method addContent.
@Override
public void addContent(Inventory inventory) {
inventory.clear();
InventoryUtils.fillInventory(inventory, IridiumSkyblock.getInstance().getInventories().upgradesGUI.background);
for (Map.Entry<String, Upgrade<?>> upgrade : IridiumSkyblock.getInstance().getUpgradesList().entrySet()) {
Item item = upgrade.getValue().item;
int level = IridiumSkyblock.getInstance().getIslandManager().getIslandUpgrade(getIsland(), upgrade.getKey()).getLevel();
List<Placeholder> placeholderList = new ArrayList<>();
placeholderList.add(new Placeholder("level", String.valueOf(level)));
if (upgrade.getValue().upgrades.get(level) != null) {
UpgradeData upgradeData = upgrade.getValue().upgrades.get(level);
placeholderList.addAll(upgradeData.getPlaceholders());
}
if (upgrade.getValue().upgrades.get(level + 1) != null) {
UpgradeData upgradeData = upgrade.getValue().upgrades.get(level + 1);
placeholderList.add(new Placeholder("crystalscost", String.valueOf(upgradeData.crystals)));
placeholderList.add(new Placeholder("vaultcost", String.valueOf(upgradeData.money)));
} else if (!upgrade.getValue().upgrades.containsKey(level + 1)) {
placeholderList.add(new Placeholder("crystalscost", IridiumSkyblock.getInstance().getPlaceholders().crystalCost));
placeholderList.add(new Placeholder("vaultcost", IridiumSkyblock.getInstance().getPlaceholders().vaultCost));
}
inventory.setItem(item.slot, ItemStackUtils.makeItem(item, placeholderList));
}
if (IridiumSkyblock.getInstance().getConfiguration().backButtons && getPreviousInventory() != null) {
inventory.setItem(inventory.getSize() + IridiumSkyblock.getInstance().getInventories().backButton.slot, ItemStackUtils.makeItem(IridiumSkyblock.getInstance().getInventories().backButton));
}
}
Aggregations