mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-30 13:07:46 +01:00
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:
parent
b1a131fa84
commit
720e6bbe6b
@ -1584,5 +1584,10 @@ public class Settings implements DataObject, WorldSettings {
|
||||
this.difficulty = difficulty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWaterNotSafe() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -436,7 +436,6 @@ public class UserTest {
|
||||
assertEquals(locale, console.getLocale());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void testUpdateInventory() {
|
||||
Player pl = mock(Player.class);
|
||||
|
Loading…
Reference in New Issue
Block a user