mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-22 00:58:04 +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;
|
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
|
* @return true if the default world generator should not operate in this world
|
||||||
*/
|
*/
|
||||||
boolean isUseOwnGenerator();
|
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) {
|
public List<String> getVisitorBannedCommands(World world) {
|
||||||
return worldSettings.get(Util.getWorld(world)).getVisitorBannedCommands();
|
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()) {
|
if (space1.isLiquid() && space2.isLiquid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Check if water is safe in this world
|
||||||
|
if (space1.isLiquid() && plugin.getIWM().isWaterNotSafe(l.getWorld())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Portals are not "safe"
|
// Portals are not "safe"
|
||||||
if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL
|
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 number - a number - home location to do to
|
||||||
* @param newIsland - true if this is a new island teleport
|
* @param newIsland - true if this is a new island teleport
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void homeTeleport(World world, Player player, int number, boolean newIsland) {
|
public void homeTeleport(World world, Player player, int number, boolean newIsland) {
|
||||||
User user = User.getInstance(player);
|
User user = User.getInstance(player);
|
||||||
Location home = getSafeHomeLocation(world, user, number);
|
Location home = getSafeHomeLocation(world, user, number);
|
||||||
|
@ -80,9 +80,9 @@ public class UserTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetInstanceCommandSender() {
|
public void testGetInstanceCommandSender() {
|
||||||
User user = User.getInstance(sender);
|
User user = User.getInstance(sender);
|
||||||
assertNotNull(user);
|
assertNotNull(user);
|
||||||
assertEquals(sender,user.getSender());
|
assertEquals(sender,user.getSender());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -436,7 +436,6 @@ public class UserTest {
|
|||||||
assertEquals(locale, console.getLocale());
|
assertEquals(locale, console.getLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateInventory() {
|
public void testUpdateInventory() {
|
||||||
Player pl = mock(Player.class);
|
Player pl = mock(Player.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user