mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-10 02:19:30 +01:00
Doors are not safe ground blocks.
https://github.com/BentoBoxWorld/BentoBox/issues/1517
This commit is contained in:
parent
a6d1acf59d
commit
450c459350
@ -245,6 +245,7 @@ public class IslandsManager {
|
|||||||
* @return {@code true} if the location is considered safe, {@code false} otherwise.
|
* @return {@code true} if the location is considered safe, {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean checkIfSafe(@Nullable World world, @NonNull Material ground, @NonNull Material space1, @NonNull Material space2) {
|
public boolean checkIfSafe(@Nullable World world, @NonNull Material ground, @NonNull Material space1, @NonNull Material space2) {
|
||||||
|
plugin.logDebug(ground + " " + space1 + " " + space2);
|
||||||
// Ground must be solid, space 1 and 2 must not be solid
|
// Ground must be solid, space 1 and 2 must not be solid
|
||||||
if (world == null || !ground.isSolid()
|
if (world == null || !ground.isSolid()
|
||||||
|| (space1.isSolid() && !space1.name().contains("SIGN"))
|
|| (space1.isSolid() && !space1.name().contains("SIGN"))
|
||||||
@ -274,6 +275,10 @@ public class IslandsManager {
|
|||||||
|| ground.name().contains("BOAT"))) {
|
|| ground.name().contains("BOAT"))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Signs on doors
|
||||||
|
if (ground.name().contains("DOOR")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Known unsafe blocks
|
// Known unsafe blocks
|
||||||
switch (ground) {
|
switch (ground) {
|
||||||
// Unsafe
|
// Unsafe
|
||||||
|
@ -365,6 +365,19 @@ public class IslandsManagerTest {
|
|||||||
assertFalse(manager.isSafeLocation(location));
|
assertFalse(manager.isSafeLocation(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCheckIfSafeTrapdoor() {
|
||||||
|
for (Material d : Material.values()) {
|
||||||
|
if (d.name().contains("DOOR")) {
|
||||||
|
for (Material s : Material.values()) {
|
||||||
|
if (s.name().contains("_SIGN")) {
|
||||||
|
assertFalse("Fail " + d.name() + " " + s.name(), manager.checkIfSafe(world, d, s, Material.AIR));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method for {@link world.bentobox.bentobox.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}.
|
* Test method for {@link world.bentobox.bentobox.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user