Fix Unhandled exception when executing command is top
During early game if there are less then 10 islands the IntStream.range fails. We add Math.min to either select the amount of islands available or a top of 10.
This commit is contained in:
parent
49c5cc94c1
commit
875d770742
|
|
@ -27,7 +27,7 @@ public class IslandTop extends PlayerSubCommand {
|
|||
|
||||
//TODO allow players to iterate through the list
|
||||
List<IslandData> islandData = IslandData.getIslandData(pluginConfiguration.topRefreshMinutesCoolDown());
|
||||
String islandRankings = IntStream.range(0, 10)
|
||||
String islandRankings = IntStream.range(0, Math.min(10, islandData.size()))
|
||||
.mapToObj(i -> (i + 1) + ". " + islandData.get(i).format(playerIslandId))
|
||||
.collect(Collectors.joining("\n"));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user