diff --git a/src/main/java/com/craftaro/ultimateclaims/claim/Claim.java b/src/main/java/com/craftaro/ultimateclaims/claim/Claim.java index c66f4c3..9568adb 100644 --- a/src/main/java/com/craftaro/ultimateclaims/claim/Claim.java +++ b/src/main/java/com/craftaro/ultimateclaims/claim/Claim.java @@ -28,12 +28,12 @@ import org.bukkit.entity.Player; import java.util.ArrayList; -import java.util.Collections; import java.util.HashSet; import java.util.List; -import java.util.Optional; import java.util.Set; import java.util.UUID; +import java.util.Collections; + import java.util.concurrent.ThreadLocalRandom; public class Claim { @@ -91,7 +91,11 @@ public int getId() { } public ClaimedChunk getFirstClaimedChunk() { - return this.claimedRegions.iterator().next().getFirstClaimedChunk(); + if (!this.claimedRegions.isEmpty()) { + return this.claimedRegions.iterator().next().getFirstClaimedChunk(); + } else { + return null; + } } public String getName() { diff --git a/src/main/java/com/craftaro/ultimateclaims/dynmap/DynmapManager.java b/src/main/java/com/craftaro/ultimateclaims/dynmap/DynmapManager.java index 494ef57..8a5600a 100644 --- a/src/main/java/com/craftaro/ultimateclaims/dynmap/DynmapManager.java +++ b/src/main/java/com/craftaro/ultimateclaims/dynmap/DynmapManager.java @@ -56,8 +56,8 @@ public void refresh() { if (this.plugin.getClaimManager() != null) { for (Claim claim : this.plugin.getClaimManager().getRegisteredClaims()) { - if (Bukkit.getWorld(claim.getFirstClaimedChunk().getWorld()) == null) { - continue; + if (claim.getFirstClaimedChunk() != null && Bukkit.getWorld(claim.getFirstClaimedChunk().getWorld()) == null) { + continue; } if (claim.getCorners() != null) {