mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-11 01:41:51 +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() {
|
default boolean isMakeEndPortals() {
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -726,6 +726,20 @@ public class IslandWorldManager {
|
|||||||
return gameModes.containsKey(world) && gameModes.get(world).getWorldSettings().isUseOwnGenerator();
|
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
|
* Return banned commands for visitors
|
||||||
* @return the visitorbannedcommands
|
* @return the visitorbannedcommands
|
||||||
|
@ -100,8 +100,11 @@ public class DefaultNewIslandLocationStrategy implements NewIslandLocationStrate
|
|||||||
return Result.FREE;
|
return Result.FREE;
|
||||||
}
|
}
|
||||||
// Block check
|
// Block check
|
||||||
if (!plugin.getIWM().isUseOwnGenerator(world) && Arrays.asList(BlockFace.values()).stream().anyMatch(bf ->
|
if (plugin.getIWM().isCheckForBlocks(world)
|
||||||
!location.getBlock().getRelative(bf).isEmpty() && !location.getBlock().getRelative(bf).getType().equals(Material.WATER))) {
|
&& !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
|
// Block found
|
||||||
plugin.getIslands().createIsland(location);
|
plugin.getIslands().createIsland(location);
|
||||||
return Result.BLOCKS_IN_AREA;
|
return Result.BLOCKS_IN_AREA;
|
||||||
|
Loading…
Reference in New Issue
Block a user