Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

Commit

Permalink
fix lower than 10 player
Browse files Browse the repository at this point in the history
  • Loading branch information
MidnightTale committed Sep 29, 2023
1 parent 4bc2557 commit 7c9a5fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/xyz/hynse/hyeconomy/Command/TopCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public static void execute(Player player) {
List<PlayerBalanceEntry> topPlayers = PlayerRequest.getTopPlayers(limit);
player.sendMessage((Component) MessageUtil.getMessage("top.header"));

for (int i = 0; i < topPlayers.size(); i++) {
int maxPlayersToShow = Math.min(limit, topPlayers.size());

for (int i = 0; i < maxPlayersToShow; i++) {
PlayerBalanceEntry entry = topPlayers.get(i);
String playerName = Bukkit.getOfflinePlayer(entry.getPlayerUUID()).getName();
player.sendMessage((Component) MessageUtil.getMessage("top.format", "%position%", String.valueOf(i + 1), "%player%", playerName, "%balance%", String.valueOf(entry.getBalance())));
Expand Down

0 comments on commit 7c9a5fd

Please sign in to comment.