Make superflat check more accurate

Will allow fix superflat to run in SkyGrid.

https://github.com/BentoBoxWorld/SkyGrid/issues/22
This commit is contained in:
tastybento 2019-07-27 10:47:48 -07:00
parent 2403cd201f
commit 10b8c51aee
2 changed files with 6 additions and 9 deletions

View File

@ -111,15 +111,11 @@ public class CleanSuperFlatListener extends FlagListener {
if (!ready) { if (!ready) {
return true; return true;
} }
// Clean super flat does not work if the world handles its own generator explicitly
if (getIWM().inWorld(world) && Flags.CLEAN_SUPER_FLAT.isSetForWorld(world) && getIWM().isUseOwnGenerator(world)) {
Flags.CLEAN_SUPER_FLAT.setSetting(world, false);
getPlugin().logWarning("Clean super flat is not available for " + world.getName());
return true;
}
if (!getIWM().inWorld(world) || !Flags.CLEAN_SUPER_FLAT.isSetForWorld(world) || if (!getIWM().inWorld(world) || !Flags.CLEAN_SUPER_FLAT.isSetForWorld(world) ||
(!e.getChunk().getBlock(0, 0, 0).getType().equals(Material.BEDROCK) (!(e.getChunk().getBlock(0, 0, 0).getType().equals(Material.BEDROCK)
&& e.getChunk().getBlock(0, 1, 0).getType().equals(Material.DIRT)
&& e.getChunk().getBlock(0, 2, 0).getType().equals(Material.DIRT)
&& e.getChunk().getBlock(0, 3, 0).getType().equals(Material.GRASS_BLOCK))
|| (world.getEnvironment().equals(Environment.NETHER) && (!plugin.getIWM().isNetherGenerate(world) || (world.getEnvironment().equals(Environment.NETHER) && (!plugin.getIWM().isNetherGenerate(world)
|| !plugin.getIWM().isNetherIslands(world))) || !plugin.getIWM().isNetherIslands(world)))
|| (world.getEnvironment().equals(Environment.THE_END) && (!plugin.getIWM().isEndGenerate(world) || (world.getEnvironment().equals(Environment.THE_END) && (!plugin.getIWM().isEndGenerate(world)

View File

@ -101,7 +101,8 @@ public class CleanSuperFlatListenerTest {
chunk = mock(Chunk.class); chunk = mock(Chunk.class);
when(chunk.getWorld()).thenReturn(world); when(chunk.getWorld()).thenReturn(world);
block = mock(Block.class); block = mock(Block.class);
when(block.getType()).thenReturn(Material.BEDROCK); // Super flat!
when(block.getType()).thenReturn(Material.BEDROCK, Material.DIRT, Material.DIRT, Material.GRASS_BLOCK);
when(chunk.getBlock(Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt())).thenReturn(block); when(chunk.getBlock(Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt())).thenReturn(block);
// Fire the ready event // Fire the ready event