Require non null getCenter

This will throw a big runtime error if range is adjusted without a
center location being defined. Should only affect addons like the
Converter.
This commit is contained in:
tastybento 2021-05-11 21:29:44 -07:00
parent 17af44e67a
commit 982dc2fd52

View File

@ -9,6 +9,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -919,7 +920,7 @@ public class Island implements DataObject, MetaDataAble {
public void updateMaxEverProtectionRange() { public void updateMaxEverProtectionRange() {
// Ratchet up the maximum protection range // Ratchet up the maximum protection range
// Distance from maxes // Distance from maxes
int diffMinX = Math.abs(getCenter().getBlockX() - this.getMinProtectedX()); int diffMinX = Math.abs(Objects.requireNonNull(getCenter()).getBlockX() - this.getMinProtectedX());
int diffMaxX = Math.abs(getCenter().getBlockX() - this.getMaxProtectedX()); int diffMaxX = Math.abs(getCenter().getBlockX() - this.getMaxProtectedX());
int diffMinZ = Math.abs(getCenter().getBlockZ() - this.getMinProtectedZ()); int diffMinZ = Math.abs(getCenter().getBlockZ() - this.getMinProtectedZ());
int diffMaxZ = Math.abs(getCenter().getBlockZ() - this.getMaxProtectedZ()); int diffMaxZ = Math.abs(getCenter().getBlockZ() - this.getMaxProtectedZ());