From 7271096ace0d688919d5596b01f1dcbe63530650 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 11 Sep 2021 16:53:27 -0700 Subject: [PATCH] Ensure maxEverProtectionRange is less than range. https://github.com/BentoBoxWorld/BentoBox/issues/1851 --- .../world/bentobox/bentobox/database/objects/Island.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/world/bentobox/bentobox/database/objects/Island.java b/src/main/java/world/bentobox/bentobox/database/objects/Island.java index 8d7a2cd14..5fbc7f34a 100644 --- a/src/main/java/world/bentobox/bentobox/database/objects/Island.java +++ b/src/main/java/world/bentobox/bentobox/database/objects/Island.java @@ -561,6 +561,9 @@ public class Island implements DataObject, MetaDataAble { * @return the maxEverProtectionRange or the protection range, whichever is larger */ public int getMaxEverProtectionRange() { + if (maxEverProtectionRange > this.range) { + maxEverProtectionRange = this.range; + } return Math.max(protectionRange, maxEverProtectionRange); } @@ -569,6 +572,9 @@ public class Island implements DataObject, MetaDataAble { */ public void setMaxEverProtectionRange(int maxEverProtectionRange) { this.maxEverProtectionRange = maxEverProtectionRange; + if (maxEverProtectionRange > this.range) { + maxEverProtectionRange = this.range; + } setChanged(); }