Skip to content

Commit

Permalink
fix: disabled regions
Browse files Browse the repository at this point in the history
  • Loading branch information
RockinChaos committed Oct 20, 2024
1 parent 6e0b69e commit 9f6364d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/java/me/RockinChaos/itemjoin/item/ItemMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -3027,12 +3027,14 @@ public Boolean inRegion(final String region) {
if ((this.enabledRegions == null || this.enabledRegions.isEmpty()) && (this.disabledRegions == null || this.disabledRegions.isEmpty())) {
return true;
}
if (this.enabledRegions != null) {
if (this.enabledRegions != null && !this.enabledRegions.isEmpty()) {
for (String compareRegion : this.enabledRegions) {
if (compareRegion.equalsIgnoreCase(region) || compareRegion.equalsIgnoreCase("UNDEFINED")) {
return !this.isDisabledRegion(region);
}
}
} else {
return !this.isDisabledRegion(region);
}
return false;
}
Expand Down Expand Up @@ -3060,7 +3062,9 @@ public Boolean inRegion(final List<String> regions) {
if (this.disabledRegions != null) {
for (String compareRegion : this.disabledRegions) {
if (compareRegion.equalsIgnoreCase(region) || compareRegion.equalsIgnoreCase("UNDEFINED")) {
if (inRegion != 2) {
if (this.enabledRegions == null || this.enabledRegions.isEmpty()) {
inRegion = 1;
} else if (inRegion != 2) {
inRegion = !this.isDisabledRegion(compareRegion) ? inRegion : 2;
}
}
Expand All @@ -3078,10 +3082,12 @@ public Boolean inRegion(final List<String> regions) {
*/
public boolean isDisabledRegion(final String region) {
boolean isDisabled = false;
for (String disabledRegion : this.disabledRegions) {
if (disabledRegion.equalsIgnoreCase(region)) {
isDisabled = true;
break;
if (this.disabledRegions != null) {
for (String disabledRegion : this.disabledRegions) {
if (disabledRegion.equalsIgnoreCase(region)) {
isDisabled = true;
break;
}
}
}
return isDisabled;
Expand Down

0 comments on commit 9f6364d

Please sign in to comment.