Skip to content

Commit

Permalink
fixed #9
Browse files Browse the repository at this point in the history
  • Loading branch information
PMFRTT committed Apr 9, 2021
1 parent 5590e58 commit fe9f807
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main/java/bingo/SideList.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;


Expand Down Expand Up @@ -51,6 +52,10 @@ public static void updateScoreboard() {
for (String name : playerScoreboards.keySet()) {
Player player = Bukkit.getPlayer(name);
Scoreboard scoreboard = playerScoreboards.get(name);
List<String> scores = new ArrayList<String>();
for (Score score : scoreboard.getScores()) {
scores.add(score.getContent());
}
for (Material material : BingoList.getBingoList(Objects.requireNonNull(player))) {
if (BingoList.playerCollectedList.get(name).contains(material)) {
removeScore(player, material);
Expand All @@ -63,7 +68,15 @@ public static void updateScoreboard() {
scoreboard.addScore(new Score(core.Utils.colorize("&c" + Utils.formatMaterialName(material)), 1));
}
}
startRender(player);
int i = 0;
for (Score score : scoreboard.getScores()) {
if (scores.contains(score.getContent())) {
i++;
}
}
if (i != BingoPlugin.items) {
startRender(player);
}
}
}

Expand All @@ -79,7 +92,7 @@ private static void startRender(Player player) {
DebugSender.sendDebug(DebugType.GUI, "rendered sidelist", "Sidelist");
}

public static void removePlayer(Player player){
public static void removePlayer(Player player) {
playerScoreboards.remove(player.getDisplayName());
playerScoreboardsDisplay.remove(player.getDisplayName());
}
Expand Down

0 comments on commit fe9f807

Please sign in to comment.