Simplified safe check, removed debug.

This commit is contained in:
tastybento 2020-09-06 16:20:48 -07:00
parent 450c459350
commit f4a4b6053a

View File

@ -245,7 +245,6 @@ 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"))
@ -256,27 +255,18 @@ public class IslandsManager {
if (space1.equals(Material.WATER) && (space2.equals(Material.WATER) || plugin.getIWM().isWaterNotSafe(world))) { if (space1.equals(Material.WATER) && (space2.equals(Material.WATER) || plugin.getIWM().isWaterNotSafe(world))) {
return false; return false;
} }
// Lava // Unsafe
if (ground.equals(Material.LAVA) if (ground.equals(Material.LAVA)
|| space1.equals(Material.LAVA) || space1.equals(Material.LAVA)
|| space2.equals(Material.LAVA)) { || space2.equals(Material.LAVA)
return false; || ground.name().contains("FENCE")
} || ground.name().contains("DOOR")
// Unsafe types || ground.name().contains("GATE")
if (((space1.equals(Material.AIR) && space2.equals(Material.AIR)) || ground.name().contains("PLATE")
|| (space1.equals(Material.NETHER_PORTAL) && space2.equals(Material.NETHER_PORTAL))) || ground.name().contains("SIGN")
&& (ground.name().contains("FENCE") || ground.name().contains("BANNER")
|| ground.name().contains("DOOR") || ground.name().contains("BUTTON")
|| ground.name().contains("GATE") || ground.name().contains("BOAT")) {
|| ground.name().contains("PLATE")
|| ground.name().contains("SIGN")
|| ground.name().contains("BANNER")
|| ground.name().contains("BUTTON")
|| ground.name().contains("BOAT"))) {
return false;
}
// Signs on doors
if (ground.name().contains("DOOR")) {
return false; return false;
} }
// Known unsafe blocks // Known unsafe blocks