Skip to content

Commit

Permalink
Merged enhancement placeholders
Browse files Browse the repository at this point in the history
- fixed an error in loop logic
  • Loading branch information
sh0inx committed Mar 16, 2024
1 parent bd2609b commit 1159cbb
Showing 1 changed file with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public List<Placeholder> getPlaceholders(Island island) {

for(User user : users) {
if(user.getPlayer() != null) onlineUsers.add(user.getName());
offlineUsers.add(user.getName());
else offlineUsers.add(user.getName());
}

List<Placeholder> placeholderList = new ArrayList<>(Arrays.asList(
Expand Down Expand Up @@ -74,23 +74,14 @@ public List<Placeholder> getPlaceholders(Island island) {
placeholderList.add(new Placeholder("island_visitors_amount", () -> String.valueOf(visitingPlayers.size())));

for(Map.Entry<String, Enhancement<?>> enhancement : IridiumSkyblock.getInstance().getEnhancementList().entrySet()) {
if(!enhancement.getValue().enabled) continue;
TeamEnhancement teamEnhancement = IridiumSkyblock.getInstance().getIslandManager().getTeamEnhancement(island, enhancement.getKey());

if(enhancement.getValue().enabled && enhancement.getValue().type == EnhancementType.BOOSTER) {
placeholderList.add(new Placeholder("island_booster_" + enhancement.getKey() + "_active", () -> String.valueOf(teamEnhancement.isActive())));
placeholderList.add(new Placeholder("island_booster_" + enhancement.getKey() + "_level", () -> String.valueOf(teamEnhancement.getLevel())));
placeholderList.add(new Placeholder("island_booster_" + enhancement.getKey() + "_time_hours", () -> String.valueOf(Math.max((int) (teamEnhancement.getRemainingTime() % 60), 0))));
placeholderList.add(new Placeholder("island_booster_" + enhancement.getKey() + "_time_minutes", () -> String.valueOf(Math.max((int) ((teamEnhancement.getRemainingTime() % 3600) / 60), 0))));
placeholderList.add(new Placeholder("island_booster_" + enhancement.getKey() + "_time_seconds", () -> String.valueOf(Math.max((int) (teamEnhancement.getRemainingTime() / 3600), 0))));
}

if(enhancement.getValue().enabled && enhancement.getValue().type == EnhancementType.UPGRADE) {
placeholderList.add(new Placeholder("island_upgrade_" + enhancement.getKey() + "_active", () -> String.valueOf(teamEnhancement.isActive())));
placeholderList.add(new Placeholder("island_upgrade_" + enhancement.getKey() + "_level", () -> String.valueOf(teamEnhancement.getLevel())));
placeholderList.add(new Placeholder("island_upgrade_" + enhancement.getKey() + "_time_hours", () -> String.valueOf(Math.max((int) (teamEnhancement.getRemainingTime() % 60), 0))));
placeholderList.add(new Placeholder("island_upgrade_" + enhancement.getKey() + "_time_minutes", () -> String.valueOf(Math.max((int) ((teamEnhancement.getRemainingTime() % 3600) / 60), 0))));
placeholderList.add(new Placeholder("island_upgrade_" + enhancement.getKey() + "_time_seconds", () -> String.valueOf(Math.max((int) (teamEnhancement.getRemainingTime() / 3600), 0))));
}
placeholderList.add(new Placeholder("island_enhancement_" + enhancement.getKey() + "_active", () -> String.valueOf(teamEnhancement.isActive())));
placeholderList.add(new Placeholder("island_enhancement_" + enhancement.getKey() + "_level", () -> String.valueOf(teamEnhancement.getLevel())));
placeholderList.add(new Placeholder("island_enhancement_" + enhancement.getKey() + "_time_hours", () -> String.valueOf(Math.max((int) (teamEnhancement.getRemainingTime() % 60), 0))));
placeholderList.add(new Placeholder("island_enhancement_" + enhancement.getKey() + "_time_minutes", () -> String.valueOf(Math.max((int) ((teamEnhancement.getRemainingTime() % 3600) / 60), 0))));
placeholderList.add(new Placeholder("island_enhancement_" + enhancement.getKey() + "_time_seconds", () -> String.valueOf(Math.max((int) (teamEnhancement.getRemainingTime() / 3600), 0))));
}

for (BankItem bankItem : IridiumSkyblock.getInstance().getBankItemList()) {
Expand Down

0 comments on commit 1159cbb

Please sign in to comment.