From 7806d981497541de9e6ab4fc22881d8010130bd1 Mon Sep 17 00:00:00 2001 From: Penal Buffalo Date: Tue, 30 Nov 2021 11:11:51 -0600 Subject: [PATCH] 3.2.6 b576 * fixed rule allowed-worldguard-regions breaking levelling on regions outside of the list --- pom.xml | 2 +- .../managers/ExternalCompatibilityManager.java | 5 +++-- .../me/lokka30/levelledmobs/rules/RulesManager.java | 12 ++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index a3f954152..e3af66b46 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ me.lokka30 LevelledMobs - 3.2.6 b575 + 3.2.6 b576 jar LevelledMobs diff --git a/src/main/java/me/lokka30/levelledmobs/managers/ExternalCompatibilityManager.java b/src/main/java/me/lokka30/levelledmobs/managers/ExternalCompatibilityManager.java index c185f43d1..729bcb575 100644 --- a/src/main/java/me/lokka30/levelledmobs/managers/ExternalCompatibilityManager.java +++ b/src/main/java/me/lokka30/levelledmobs/managers/ExternalCompatibilityManager.java @@ -19,6 +19,7 @@ import org.jetbrains.annotations.Nullable; import simplepets.brainsynder.api.plugin.SimplePets; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -337,9 +338,9 @@ public static boolean isMobOfShopkeepers(final @NotNull LivingEntityWrapper lmEn return isExternalType; } - @Nullable + @NotNull public static List getWGRegionsAtLocation(@NotNull final LivingEntityInterface lmInterface){ - if (!ExternalCompatibilityManager.hasWorldGuardInstalled()) return null; + if (!ExternalCompatibilityManager.hasWorldGuardInstalled()) return Collections.emptyList(); return WorldGuardIntegration.getWorldGuardRegionsForLocation(lmInterface); } diff --git a/src/main/java/me/lokka30/levelledmobs/rules/RulesManager.java b/src/main/java/me/lokka30/levelledmobs/rules/RulesManager.java index a97d00372..73f0da184 100644 --- a/src/main/java/me/lokka30/levelledmobs/rules/RulesManager.java +++ b/src/main/java/me/lokka30/levelledmobs/rules/RulesManager.java @@ -644,12 +644,12 @@ private boolean isRuleApplicable_Entity(final LivingEntityWrapper lmEntity, @Not if (ri.conditions_WGRegions != null){ boolean isInList = false; final List wgRegions = ExternalCompatibilityManager.getWGRegionsAtLocation(lmInterface); - if (wgRegions != null) { - for (final String regionName : wgRegions) { - if (ri.conditions_WGRegions.isEnabledInList(regionName, null)) { - isInList = true; - break; - } + if (wgRegions.isEmpty()) wgRegions.add("(none)"); + + for (final String regionName : wgRegions) { + if (ri.conditions_WGRegions.isEnabledInList(regionName, null)) { + isInList = true; + break; } }