diff --git a/src/main/java/world/bentobox/bentobox/api/flags/FlagListener.java b/src/main/java/world/bentobox/bentobox/api/flags/FlagListener.java index 60a795d5a..9c2a260ae 100644 --- a/src/main/java/world/bentobox/bentobox/api/flags/FlagListener.java +++ b/src/main/java/world/bentobox/bentobox/api/flags/FlagListener.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.Listener; - import org.bukkit.metadata.MetadataValue; + import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.api.localization.TextVariables; import world.bentobox.bentobox.api.user.User; @@ -148,10 +148,7 @@ public abstract class FlagListener implements Listener { */ public boolean checkIsland(Event e, Location loc, Flag flag, boolean silent) { // If this is not an Island World or a standard Nether or End, skip - if (!plugin.getIWM().inWorld(loc) - || (plugin.getIWM().isNether(loc.getWorld()) && !plugin.getIWM().isNetherIslands(loc.getWorld())) - || (plugin.getIWM().isEnd(loc.getWorld()) && !plugin.getIWM().isEndIslands(loc.getWorld())) - ) { + if (!plugin.getIWM().inWorld(loc)) { report(user, e, loc, flag, Why.UNPROTECTED_WORLD); return true; } @@ -180,7 +177,7 @@ public abstract class FlagListener implements Listener { } // Ops or "bypass everywhere" moderators can do anything - if (user.isOp() || user.hasPermission(getIWM().getPermissionPrefix(loc.getWorld()) + ".mod.bypass." + flag.getID() + ".everywhere")) { + if (user.isOp() || user.hasPermission(getIWM().getPermissionPrefix(loc.getWorld()) + ".mod.bypass." + flag.getID() + ".everywhere")) { if (user.isOp()) { report(user, e, loc, flag, Why.OP); } else { @@ -203,7 +200,7 @@ public abstract class FlagListener implements Listener { report(user, e, loc, flag, Why.BYPASS_ISLAND); user = null; return true; - } + } report(user, e, loc, flag, Why.NOT_ALLOWED_ON_ISLAND); noGo(e, flag, silent); // Clear the user for the next time diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/FireListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/FireListener.java index 2c63e5053..3558257ae 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/FireListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/FireListener.java @@ -13,8 +13,8 @@ import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.BlockIterator; -import world.bentobox.bentobox.api.flags.FlagListener; import world.bentobox.bentobox.api.flags.Flag; +import world.bentobox.bentobox.api.flags.FlagListener; import world.bentobox.bentobox.lists.Flags; /** diff --git a/src/main/java/world/bentobox/bentobox/managers/IslandWorldManager.java b/src/main/java/world/bentobox/bentobox/managers/IslandWorldManager.java index ffdc78623..23c240910 100644 --- a/src/main/java/world/bentobox/bentobox/managers/IslandWorldManager.java +++ b/src/main/java/world/bentobox/bentobox/managers/IslandWorldManager.java @@ -82,7 +82,9 @@ public class IslandWorldManager { * @return true if in a world or false if not */ public boolean inWorld(World world) { - return worlds.containsKey(Util.getWorld(world)); + return ((world.getEnvironment().equals(Environment.NETHER) && isIslandNether(world)) + || (world.getEnvironment().equals(Environment.THE_END) && isIslandEnd(world)) + || (world.getEnvironment().equals(Environment.NORMAL)) && worlds.containsKey(world)); } /** @@ -302,7 +304,7 @@ public class IslandWorldManager { */ public boolean isNether(World world) { World w = Util.getWorld(world); - return worldSettings.containsKey(w) && worldSettings.get(w).isNetherGenerate(); + return world.getEnvironment().equals(Environment.NETHER) && worldSettings.containsKey(w) && worldSettings.get(w).isNetherGenerate(); } /** @@ -314,7 +316,7 @@ public class IslandWorldManager { */ public boolean isIslandNether(World world) { World w = Util.getWorld(world); - return worldSettings.containsKey(w) && worldSettings.get(w).isNetherGenerate() + return world.getEnvironment().equals(Environment.NETHER) && worldSettings.containsKey(w) && worldSettings.get(w).isNetherGenerate() && worldSettings.get(w).isNetherIslands(); } @@ -327,7 +329,7 @@ public class IslandWorldManager { */ public boolean isEnd(World world) { World w = Util.getWorld(world); - return worldSettings.containsKey(w) && worldSettings.get(w).isEndGenerate(); + return world.getEnvironment().equals(Environment.THE_END) && worldSettings.containsKey(w) && worldSettings.get(w).isEndGenerate(); } /** @@ -339,7 +341,7 @@ public class IslandWorldManager { */ public boolean isIslandEnd(World world) { World w = Util.getWorld(world); - return worldSettings.containsKey(w) && worldSettings.get(w).isEndGenerate() + return world.getEnvironment().equals(Environment.THE_END) && worldSettings.containsKey(w) && worldSettings.get(w).isEndGenerate() && worldSettings.get(w).isEndIslands(); }