mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35:44 +01:00
Protection checks not correctly taking into account std Nether and End
https://github.com/BentoBoxWorld/bentobox/issues/331 The isIslandNether(), isNether(), etc. methods need to check the environment of the world.
This commit is contained in:
parent
3b36ab8814
commit
37aa2e06f9
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user