use of com.iridium.iridiumcore.utils.Placeholder in project IridiumSkyblock by Iridium-Development.
the class IslandRewardsGUI method addContent.
@Override
public void addContent(Inventory inventory) {
inventory.clear();
InventoryUtils.fillInventory(inventory, IridiumSkyblock.getInstance().getInventories().islandReward.background);
List<Placeholder> placeholders = new PlaceholderBuilder().applyIslandPlaceholders(getIsland()).build();
// slot 0
int maxSize = inventory.getSize() - 1;
AtomicInteger atomicInteger = new AtomicInteger(0);
for (IslandReward islandReward : IridiumSkyblock.getInstance().getDatabaseManager().getIslandRewardTableManager().getEntries(getIsland())) {
if (atomicInteger.get() > maxSize)
break;
inventory.setItem(atomicInteger.getAndIncrement(), ItemStackUtils.makeItem(islandReward.getReward().item, placeholders));
}
if (IridiumSkyblock.getInstance().getConfiguration().backButtons && getPreviousInventory() != null) {
inventory.setItem(inventory.getSize() + IridiumSkyblock.getInstance().getInventories().backButton.slot, ItemStackUtils.makeItem(IridiumSkyblock.getInstance().getInventories().backButton));
}
}
use of com.iridium.iridiumcore.utils.Placeholder in project IridiumSkyblock by Iridium-Development.
the class IslandTrustedGUI method addContent.
@Override
public void addContent(Inventory inventory) {
inventory.clear();
InventoryUtils.fillInventory(inventory, IridiumSkyblock.getInstance().getInventories().trustedGUI.background);
List<IslandTrusted> islandTrustedList = IridiumSkyblock.getInstance().getDatabaseManager().getIslandTrustedTableManager().getEntries(getIsland());
AtomicInteger slot = new AtomicInteger(0);
for (IslandTrusted islandTrusted : islandTrustedList) {
int itemSlot = slot.getAndIncrement();
List<Placeholder> placeholderList = new PlaceholderBuilder().applyPlayerPlaceholders(islandTrusted.getUser()).applyIslandPlaceholders(getIsland()).build();
placeholderList.add(new Placeholder("trustee", islandTrusted.getTruster().getName()));
inventory.setItem(itemSlot, ItemStackUtils.makeItem(IridiumSkyblock.getInstance().getInventories().trustedGUI.item, placeholderList));
members.put(itemSlot, islandTrusted.getUser());
}
}
use of com.iridium.iridiumcore.utils.Placeholder 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));
}
}
use of com.iridium.iridiumcore.utils.Placeholder in project IridiumSkyblock by Iridium-Development.
the class IslandPermissionsGUI method addContent.
@Override
public void addContent(Inventory inventory) {
inventory.clear();
InventoryUtils.fillInventory(inventory, IridiumSkyblock.getInstance().getInventories().islandPermissionsGUI.background);
inventory.setItem(inventory.getSize() - 3, ItemStackUtils.makeItem(IridiumSkyblock.getInstance().getInventories().nextPage));
inventory.setItem(inventory.getSize() - 7, ItemStackUtils.makeItem(IridiumSkyblock.getInstance().getInventories().previousPage));
for (Map.Entry<String, Permission> permission : IridiumSkyblock.getInstance().getPermissionList().entrySet()) {
if (permission.getValue().getPage() != page)
continue;
if (!permission.getValue().isModifiable())
continue;
boolean allowed = IridiumSkyblock.getInstance().getIslandManager().getIslandPermission(getIsland(), islandRank, permission.getValue(), permission.getKey());
inventory.setItem(permission.getValue().getItem().slot, ItemStackUtils.makeItem(permission.getValue().getItem(), Collections.singletonList(new Placeholder("permission", allowed ? IridiumSkyblock.getInstance().getPermissions().allowed : IridiumSkyblock.getInstance().getPermissions().denied))));
}
if (IridiumSkyblock.getInstance().getConfiguration().backButtons && getPreviousInventory() != null) {
inventory.setItem(inventory.getSize() + IridiumSkyblock.getInstance().getInventories().backButton.slot, ItemStackUtils.makeItem(IridiumSkyblock.getInstance().getInventories().backButton));
}
}
use of com.iridium.iridiumcore.utils.Placeholder in project IridiumSkyblock by Iridium-Development.
the class IslandRanksGUI method addContent.
@Override
public void addContent(Inventory inventory) {
inventory.clear();
IslandRanksInventoryConfig islandRanks = IridiumSkyblock.getInstance().getInventories().islandRanksGUI;
InventoryUtils.fillInventory(inventory, islandRanks.background);
List<User> members = IridiumSkyblock.getInstance().getIslandManager().getIslandMembers(getIsland());
inventory.setItem(islandRanks.owner.slot, ItemStackUtils.makeItem(islandRanks.owner, Collections.singletonList(new Placeholder("members", getIsland().getOwner().getName()))));
inventory.setItem(islandRanks.coOwner.slot, ItemStackUtils.makeItem(islandRanks.coOwner, Collections.singletonList(new Placeholder("members", members.stream().filter(member -> member.getIslandRank().equals(IslandRank.CO_OWNER)).map(User::getName).collect(Collectors.joining(", "))))));
inventory.setItem(islandRanks.moderator.slot, ItemStackUtils.makeItem(islandRanks.moderator, Collections.singletonList(new Placeholder("members", members.stream().filter(member -> member.getIslandRank().equals(IslandRank.MODERATOR)).map(User::getName).collect(Collectors.joining(", "))))));
inventory.setItem(islandRanks.member.slot, ItemStackUtils.makeItem(islandRanks.member, Collections.singletonList(new Placeholder("members", members.stream().filter(member -> member.getIslandRank().equals(IslandRank.MEMBER)).map(User::getName).collect(Collectors.joining(", "))))));
inventory.setItem(islandRanks.visitor.slot, ItemStackUtils.makeItem(islandRanks.visitor));
if (IridiumSkyblock.getInstance().getConfiguration().backButtons && getPreviousInventory() != null) {
inventory.setItem(inventory.getSize() + IridiumSkyblock.getInstance().getInventories().backButton.slot, ItemStackUtils.makeItem(IridiumSkyblock.getInstance().getInventories().backButton));
}
}
Aggregations