package ua.com.minersstudios.whomine.util.misc;
import java.util.ArrayList;
import java.util.List;
import lombok.NonNull;
import net.kyori.adventure.util.TriState;
import org.bukkit.block.Biome;
import org.bukkit.Difficulty;
import org.bukkit.generator.BiomeProvider;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.generator.WorldInfo;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import static org.bukkit.GameRule.*;
public class WorldDark
{
public static World initialiseWorldDark()
{
World world = new WorldCreator("world_dark")
.type(WorldType.FLAT)
.environment(World.Environment.NORMAL)
.biomeProvider(new BiomeProvider()
{
@Override
public Biome getBiome(
@NonNull final WorldInfo worldInfo,
final int x, final int y, final int z) { return Biome.FOREST; }
@Override
public List<Biome> getBiomes(@NonNull final WorldInfo worldInfo)
{ return new ArrayList<>(); }
})
.generator(new ChunkGenerator() {})
.generateStructures(false)
.hardcore(false)
.keepSpawnLoaded(TriState.TRUE)
.createWorld();
assert world != null;
// Set the environment.
world.setDifficulty(Difficulty.PEACEFUL);
world.setGameRule(DO_DAYLIGHT_CYCLE, false);
world.setGameRule(DO_WEATHER_CYCLE, false);
world.setGameRule(DROWNING_DAMAGE, false);
world.setGameRule(FALL_DAMAGE, false);
world.setGameRule(FIRE_DAMAGE, false);
world.setGameRule(FREEZE_DAMAGE, false);
world.setGameRule(KEEP_INVENTORY, true);
world.setGameRule(SHOW_DEATH_MESSAGES, false);
world.setTime(18000L);
return world;
}
}