diff options
author | bowser0000 <bowser0000@gmail.com> | 2022-08-04 16:37:26 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2022-08-04 16:37:26 -0400 |
commit | b3eb1191c49eee416b71859ee8303293e9aed72b (patch) | |
tree | 722e0dd467f0a11341753e78a288409068d8bff9 /src/main/java/me | |
parent | 8f01ffda41f532dbdfbe70a21c6c02f4fc713c1e (diff) | |
download | SkyblockMod-b3eb1191c49eee416b71859ee8303293e9aed72b.tar.gz SkyblockMod-b3eb1191c49eee416b71859ee8303293e9aed72b.tar.bz2 SkyblockMod-b3eb1191c49eee416b71859ee8303293e9aed72b.zip |
Fix exception in scoreboard
Diffstat (limited to 'src/main/java/me')
-rw-r--r-- | src/main/java/me/Danker/handlers/ScoreboardHandler.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/me/Danker/handlers/ScoreboardHandler.java b/src/main/java/me/Danker/handlers/ScoreboardHandler.java index c8bc7c7..b5785e3 100644 --- a/src/main/java/me/Danker/handlers/ScoreboardHandler.java +++ b/src/main/java/me/Danker/handlers/ScoreboardHandler.java @@ -11,6 +11,7 @@ import net.minecraft.util.StringUtils; import java.util.ArrayList; import java.util.Collection; +import java.util.ConcurrentModificationException; import java.util.List; import java.util.stream.Collectors; @@ -38,7 +39,14 @@ public class ScoreboardHandler { ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); if (objective == null) return lines; - Collection<Score> scores = scoreboard.getSortedScores(objective); + Collection<Score> scores; + try { + scores = scoreboard.getSortedScores(objective); + } catch (ConcurrentModificationException ex) { + ex.printStackTrace(); + return new ArrayList<>(); + } + List<Score> list = scores.stream() .filter(input -> input != null && input.getPlayerName() != null && !input.getPlayerName() .startsWith("#")) |