Filter out null islands in worlds where players have none in world.

This commit is contained in:
tastybento 2021-02-28 11:55:43 -08:00
parent 9bb45ae426
commit f4ff1bb412

View File

@ -3,6 +3,7 @@ package world.bentobox.bentobox.listeners;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import org.bukkit.Bukkit;
@ -90,9 +91,10 @@ public class JoinLeaveListener implements Listener {
// Clear inventory if required
clearPlayersInventory(Util.getWorld(event.getPlayer().getWorld()), user);
// Set island max members based on permissions if this player is the owner of an island
// Set island max members and homes based on permissions if this player is the owner of an island
plugin.getIWM().getOverWorlds().stream()
.map(w -> plugin.getIslands().getIsland(w, playerUUID))
.filter(Objects::nonNull)
.filter(i -> playerUUID.equals(i.getOwner()))
.forEach(i -> {
plugin.getIslands().getMaxMembers(i, RanksManager.MEMBER_RANK);