public class WorldCreator extends Object
Constructor | Description |
---|---|
WorldCreator(String name) |
Creates an empty WorldCreationOptions for the given world name
|
Modifier and Type | Method | Description |
---|---|---|
WorldCreator |
copy(World world) |
Copies the options from the specified world
|
WorldCreator |
copy(WorldCreator creator) |
Copies the options from the specified
WorldCreator |
World |
createWorld() |
Creates a world with the specified options.
|
World.Environment |
environment() |
Gets the environment that will be used to create or load the world
|
WorldCreator |
environment(World.Environment env) |
Sets the environment that will be used to create or load the world
|
boolean |
generateStructures() |
Gets whether or not structures will be generated in the world.
|
WorldCreator |
generateStructures(boolean generate) |
Sets whether or not worlds created or loaded with this creator will
have structures.
|
ChunkGenerator |
generator() |
Gets the generator that will be used to create or load the world.
|
WorldCreator |
generator(String generator) |
Sets the generator that will be used to create or load the world.
|
WorldCreator |
generator(String generator,
CommandSender output) |
Sets the generator that will be used to create or load the world.
|
WorldCreator |
generator(ChunkGenerator generator) |
Sets the generator that will be used to create or load the world.
|
String |
generatorSettings() |
Gets the generator settings of the world that will be created or loaded.
|
WorldCreator |
generatorSettings(String generatorSettings) |
Sets the generator settings of the world that will be created or loaded.
|
static ChunkGenerator |
getGeneratorForName(String world,
String name,
CommandSender output) |
Attempts to get the
ChunkGenerator with the given name. |
boolean |
hardcore() |
Gets whether the world will be hardcore or not.
|
WorldCreator |
hardcore(boolean hardcore) |
Sets whether the world will be hardcore or not.
|
String |
name() |
Gets the name of the world that is to be loaded or created.
|
static WorldCreator |
name(String name) |
Creates a new
WorldCreator for the given world name |
long |
seed() |
Gets the seed that will be used to create this world
|
WorldCreator |
seed(long seed) |
Sets the seed that will be used to create this world
|
WorldType |
type() |
Gets the type of the world that will be created or loaded
|
WorldCreator |
type(WorldType type) |
Sets the type of the world that will be created or loaded
|
public WorldCreator(@NotNull String name)
name
- Name of the world that will be created@NotNull public WorldCreator copy(@NotNull World world)
world
- World to copy options from@NotNull public WorldCreator copy(@NotNull WorldCreator creator)
WorldCreator
creator
- World creator to copy options from@NotNull public String name()
public long seed()
@NotNull public WorldCreator seed(long seed)
seed
- World seed@NotNull public World.Environment environment()
@NotNull public WorldCreator environment(@NotNull World.Environment env)
env
- World environment@NotNull public WorldType type()
@NotNull public WorldCreator type(@NotNull WorldType type)
type
- World type@Nullable public ChunkGenerator generator()
This may be null, in which case the "natural" generator for this environment will be used.
@NotNull public WorldCreator generator(@Nullable ChunkGenerator generator)
This may be null, in which case the "natural" generator for this environment will be used.
generator
- Chunk generator@NotNull public WorldCreator generator(@Nullable String generator)
This may be null, in which case the "natural" generator for this environment will be used.
If the generator cannot be found for the given name, the natural environment generator will be used instead and a warning will be printed to the console.
generator
- Name of the generator to use, in "plugin:id" notation@NotNull public WorldCreator generator(@Nullable String generator, @Nullable CommandSender output)
This may be null, in which case the "natural" generator for this environment will be used.
If the generator cannot be found for the given name, the natural environment generator will be used instead and a warning will be printed to the specified output
generator
- Name of the generator to use, in "plugin:id" notationoutput
- CommandSender
that will receive any error
messages@NotNull public WorldCreator generatorSettings(@NotNull String generatorSettings)
Currently only WorldType.FLAT
uses these settings, and expects
them to be in JSON format with a valid biome defined. An example valid
configuration is as follows:
{"layers": [{"block": "stone", "height": 1}, {"block": "grass", "height": 1}], "biome":"plains"}
generatorSettings
- The settings that should be used by the
generator@NotNull public String generatorSettings()
generatorSettings(java.lang.String)
@NotNull public WorldCreator generateStructures(boolean generate)
generate
- Whether to generate structurespublic boolean generateStructures()
@NotNull public WorldCreator hardcore(boolean hardcore)
hardcore
- Whether the world will be hardcorepublic boolean hardcore()
@Nullable public World createWorld()
If the world already exists, it will be loaded from disk and some options may be ignored.
@NotNull public static WorldCreator name(@NotNull String name)
WorldCreator
for the given world namename
- Name of the world to load or create@Nullable public static ChunkGenerator getGeneratorForName(@NotNull String world, @Nullable String name, @Nullable CommandSender output)
ChunkGenerator
with the given name.
If the generator is not found, null will be returned and a message will
be printed to the specified CommandSender
explaining why.
The name must be in the "plugin:id" notation, or optionally just "plugin", where "plugin" is the safe-name of a plugin and "id" is an optional unique identifier for the generator you wish to request from the plugin.
world
- Name of the world this will be used forname
- Name of the generator to retrieveoutput
- Where to output if errors are presentCopyright © 2020. All rights reserved.