Fixed an issue with the placeholders.

This commit is contained in:
Brianna 2021-01-20 13:19:39 -06:00
parent fd58667bd9
commit af3034fcc2

View File

@ -404,7 +404,8 @@ public class PlaceholderProcessor {
} }
} else if(placeholder.toLowerCase().startsWith("fabledskyblock_leaderboard_level_")){ } else if(placeholder.toLowerCase().startsWith("fabledskyblock_leaderboard_level_")){
List<Leaderboard> leaderboardLevelPlayers = leaderboardManager.getLeaderboard(Leaderboard.Type.Level); List<Leaderboard> leaderboardLevelPlayers = leaderboardManager.getLeaderboard(Leaderboard.Type.Level);
String[] values = placeholder.split("_"); String[] values = placeholder.split("_");
int value; int value;
try { try {
@ -413,7 +414,8 @@ public class PlaceholderProcessor {
value = 1; value = 1;
} }
if (value > 0 && value < leaderboardLevelPlayers.size()) { if (value > 0 && value - 1 < leaderboardLevelPlayers.size()) {
value --;
Leaderboard leaderboard = leaderboardLevelPlayers.get(value); Leaderboard leaderboard = leaderboardLevelPlayers.get(value);
Visit visit = leaderboard.getVisit(); Visit visit = leaderboard.getVisit();
IslandLevel level = visit.getLevel(); IslandLevel level = visit.getLevel();
@ -429,7 +431,7 @@ public class PlaceholderProcessor {
returnValue = TextUtils.formatText( returnValue = TextUtils.formatText(
placeholdersLoad.getString("Placeholders.fabledskyblock_leaderboard_level.Non-empty") placeholdersLoad.getString("Placeholders.fabledskyblock_leaderboard_level.Non-empty")
.replace("{POSITION}", "" + (value)) .replace("{POSITION}", "" + (value + 1))
.replace("{PLAYER}", islandOwnerName) .replace("{PLAYER}", islandOwnerName)
.replace("{LEVEL}", NumberUtils.formatNumber(level.getLevel())) .replace("{LEVEL}", NumberUtils.formatNumber(level.getLevel()))
.replace("{POINTS}", NumberUtils.formatNumber(level.getPoints()))); .replace("{POINTS}", NumberUtils.formatNumber(level.getPoints())));