Ensure maxEverProtectionRange is less than range.

https://github.com/BentoBoxWorld/BentoBox/issues/1851
This commit is contained in:
tastybento 2021-09-11 16:53:27 -07:00
parent 3dd9e973fb
commit 7271096ace

View File

@ -561,6 +561,9 @@ public class Island implements DataObject, MetaDataAble {
* @return the maxEverProtectionRange or the protection range, whichever is larger * @return the maxEverProtectionRange or the protection range, whichever is larger
*/ */
public int getMaxEverProtectionRange() { public int getMaxEverProtectionRange() {
if (maxEverProtectionRange > this.range) {
maxEverProtectionRange = this.range;
}
return Math.max(protectionRange, maxEverProtectionRange); return Math.max(protectionRange, maxEverProtectionRange);
} }
@ -569,6 +572,9 @@ public class Island implements DataObject, MetaDataAble {
*/ */
public void setMaxEverProtectionRange(int maxEverProtectionRange) { public void setMaxEverProtectionRange(int maxEverProtectionRange) {
this.maxEverProtectionRange = maxEverProtectionRange; this.maxEverProtectionRange = maxEverProtectionRange;
if (maxEverProtectionRange > this.range) {
maxEverProtectionRange = this.range;
}
setChanged(); setChanged();
} }