mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-11-21 18:16:07 +01:00
Minor NPE defensive code
This commit is contained in:
parent
f48269ba88
commit
9469b6f2f7
@ -2,6 +2,7 @@ package world.bentobox.level;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
@ -111,7 +112,8 @@ public class PlaceholderManager {
|
||||
rank = Math.max(1, Math.min(rank, Level.TEN));
|
||||
if (weighted) {
|
||||
return addon.getManager().getWeightedTopTen(world, Level.TEN).keySet().stream().skip(rank - 1L).limit(1L)
|
||||
.findFirst().map(Island::getOwner).map(addon.getPlayers()::getName).orElse("");
|
||||
.findFirst().map(Island::getOwner).filter(Objects::nonNull).map(addon.getPlayers()::getName)
|
||||
.orElse("");
|
||||
}
|
||||
@Nullable
|
||||
UUID owner = addon.getManager().getTopTen(world, Level.TEN).keySet().stream().skip(rank - 1L).limit(1L)
|
||||
|
Loading…
Reference in New Issue
Block a user