mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-10 09:21:31 +01:00
Added a way to skip block checking for game modes.
https://github.com/BentoBoxWorld/BentoBox/issues/1694
This commit is contained in:
parent
e1d4fbec46
commit
6309c675d4
@ -555,4 +555,17 @@ public interface WorldSettings extends ConfigObject {
|
||||
default boolean isMakeEndPortals() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for blocks when searching for a new island. This is a safety net check that does a look
|
||||
* around the new island location (3x3x3 block check). If any non-air or non-water blocks are found
|
||||
* then the island is marked as being used. It is mainly for migration handling from worlds that
|
||||
* do not register island properly. It is incompatible with CaveBlock or other gamemodes that will
|
||||
* have blocks there.
|
||||
* @return true if a check for blocks should happen
|
||||
* @since 1.16.0
|
||||
*/
|
||||
default boolean isCheckForBlocks() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -725,6 +725,20 @@ public class IslandWorldManager {
|
||||
public boolean isUseOwnGenerator(@NonNull World world) {
|
||||
return gameModes.containsKey(world) && gameModes.get(world).getWorldSettings().isUseOwnGenerator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for blocks when searching for a new island. This is a safety net check that does a look
|
||||
* around the new island location (3x3x3 block check). If any non-air or non-water blocks are found
|
||||
* then the island is marked as being used. It is mainly for migration handling from worlds that
|
||||
* do not register island properly. It is incompatible with CaveBlock or other gamemodes that will
|
||||
* have blocks there.
|
||||
* @param world - world
|
||||
* @return true if a check for blocks should happen
|
||||
* @since 1.16.0
|
||||
*/
|
||||
public boolean isCheckForBlocks(@NonNull World world) {
|
||||
return gameModes.containsKey(world) && gameModes.get(world).getWorldSettings().isCheckForBlocks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return banned commands for visitors
|
||||
|
@ -75,7 +75,7 @@ public class DefaultNewIslandLocationStrategy implements NewIslandLocationStrate
|
||||
protected Result isIsland(Location location) {
|
||||
// Quick check
|
||||
if (plugin.getIslands().getIslandAt(location).isPresent()) return Result.ISLAND_FOUND;
|
||||
|
||||
|
||||
World world = location.getWorld();
|
||||
|
||||
// Check 4 corners
|
||||
@ -100,8 +100,11 @@ public class DefaultNewIslandLocationStrategy implements NewIslandLocationStrate
|
||||
return Result.FREE;
|
||||
}
|
||||
// Block check
|
||||
if (!plugin.getIWM().isUseOwnGenerator(world) && Arrays.asList(BlockFace.values()).stream().anyMatch(bf ->
|
||||
!location.getBlock().getRelative(bf).isEmpty() && !location.getBlock().getRelative(bf).getType().equals(Material.WATER))) {
|
||||
if (plugin.getIWM().isCheckForBlocks(world)
|
||||
&& !plugin.getIWM().isUseOwnGenerator(world)
|
||||
&& Arrays.asList(BlockFace.values()).stream().anyMatch(bf ->
|
||||
!location.getBlock().getRelative(bf).isEmpty()
|
||||
&& !location.getBlock().getRelative(bf).getType().equals(Material.WATER))) {
|
||||
// Block found
|
||||
plugin.getIslands().createIsland(location);
|
||||
return Result.BLOCKS_IN_AREA;
|
||||
|
Loading…
Reference in New Issue
Block a user