Added WaterIsNotSafe setting to WorldSettings

This flag is used to indicate whether being waste-deep in water is a
safe home location or not. On SkyBlock is it fine, on AcidIsland it is
not. So that's why this definition is required.

Removed unused @deprecation header. I assume switching to Spigot API
made these superfluous.
This commit is contained in:
tastybento 2018-07-17 18:48:50 -07:00
parent b1a131fa84
commit 720e6bbe6b
5 changed files with 94 additions and 73 deletions

View File

@ -1584,5 +1584,10 @@ public class Settings implements DataObject, WorldSettings {
this.difficulty = difficulty;
}
@Override
public boolean isWaterNotSafe() {
return false;
}
}

View File

@ -225,4 +225,9 @@ public interface WorldSettings {
* @return true if the default world generator should not operate in this world
*/
boolean isUseOwnGenerator();
/**
* @return true if water is not safe in this world, e.g, should not be a home location
*/
boolean isWaterNotSafe();
}

View File

@ -716,4 +716,13 @@ public class IslandWorldManager {
public List<String> getVisitorBannedCommands(World world) {
return worldSettings.get(Util.getWorld(world)).getVisitorBannedCommands();
}
/**
* Check if water is not safe, e.g., it is acid, in the world
* @param world - world
* @return true if water is not safe, e.g.for home locations
*/
public boolean isWaterNotSafe(World world) {
return worldSettings.get(Util.getWorld(world)).isWaterNotSafe();
}
}

View File

@ -69,6 +69,10 @@ public class IslandsManager {
if (space1.isLiquid() && space2.isLiquid()) {
return false;
}
// Check if water is safe in this world
if (space1.isLiquid() && plugin.getIWM().isWaterNotSafe(l.getWorld())) {
return false;
}
// Portals are not "safe"
if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
@ -515,7 +519,6 @@ public class IslandsManager {
* @param number - a number - home location to do to
* @param newIsland - true if this is a new island teleport
*/
@SuppressWarnings("deprecation")
public void homeTeleport(World world, Player player, int number, boolean newIsland) {
User user = User.getInstance(player);
Location home = getSafeHomeLocation(world, user, number);

View File

@ -436,7 +436,6 @@ public class UserTest {
assertEquals(locale, console.getLocale());
}
@SuppressWarnings("deprecation")
@Test
public void testUpdateInventory() {
Player pl = mock(Player.class);