Class CreateWorldOptions

java.lang.Object
org.mvplugins.multiverse.core.world.options.CreateWorldOptions

public final class CreateWorldOptions extends Object
Options for customizing the creation of a new world.
  • Method Details

    • worldName

      @NotNull public static @NotNull CreateWorldOptions worldName(@NotNull @NotNull String worldName)
      Creates a new CreateWorldOptions instance with the given world name.
      Parameters:
      worldName - The name of the world to create.
      Returns:
      A new CreateWorldOptions instance.
    • worldKey

      @AvailableSince("5.7") @NotNull public static @NotNull CreateWorldOptions worldKey(@NotNull @NotNull org.bukkit.NamespacedKey key)
      Creates a new CreateWorldOptions instance with the given namespaced key. Note that creating world with namespace requires PaperMC. This will not work on Spigot.
      Parameters:
      key - The namespaced key for the world to create.
      Returns:
      A new CreateWorldOptions instance.
      Since:
      5.7
    • worldKeyOrName

      @AvailableSince("5.7") @NotNull public static @NotNull CreateWorldOptions worldKeyOrName(@NotNull @NotNull WorldKeyOrName keyOrName)
      Creates a new CreateWorldOptions instance with the given world key or name. Note that creating world with namespace requires PaperMC. WorldKeyOrName parsed as namespaced key (i.e. WorldKeyOrName.isKey() is true) will not work on Spigot.
      Parameters:
      keyOrName - The key or name for the world to create.
      Returns:
      A new CreateWorldOptions instance.
      Since:
      5.7
    • keyOrName

      @AvailableSince("5.7") @NotNull public @NotNull io.vavr.control.Either<String,WorldKeyOrName> keyOrName()
      Gets the new world key or name, either unparsed as string or the WorldKeyOrName instance.
      Returns:
      The new world key or name.
      Since:
      5.7
    • worldName

      @Deprecated(forRemoval=true, since="5.7") @NotNull public @NotNull String worldName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the name of the world to create.
      Returns:
      The name of the world to create.
    • biome

      @NotNull public @NotNull CreateWorldOptions biome(@NotNull @NotNull String biome)
      Sets the single biome used for this world. This may be null, in which case the biome from the generator will be used. If no generator is specified, the "natural" biome behaviour for this environment will be used.
      Parameters:
      biome - The biome used for this world
      Returns:
      This CreateWorldOptions instance.
    • biome

      @NotNull public @NotNull String biome()
      Gets the single biome used for this world. This may be null, in which case the biome from the generator will be used. If no generator is specified, the "natural" biome behaviour for this environment will be used.
      Returns:
      The biome used for this world
    • bonusChest

      @AvailableSince("5.7") @NotNull public @NotNull CreateWorldOptions bonusChest(boolean bonusChest)
      Sets whether bonus chest should generate at spawn upon world creation.
      This feature only works on PaperMC 1.21.5+
      Parameters:
      bonusChest - Whether bonus chest should generate at spawn upon world creation.
      Returns:
      This CreateWorldOptions instance.
    • bonusChest

      @AvailableSince("5.7") public boolean bonusChest()
      Gets whether bonus chest should generate at spawn upon world creation.
      This feature only works on PaperMC 1.21.5+
      Returns:
      true if bonus chest should generate, else false.
    • environment

      @NotNull public @NotNull CreateWorldOptions environment(@NotNull org.bukkit.World.Environment environmentInput)
      Sets the environment of the world to create.
      Parameters:
      environmentInput - The environment of the world to create.
      Returns:
      This CreateWorldOptions instance.
    • environment

      @NotNull public org.bukkit.World.Environment environment()
      Gets the environment of the world to create.
      Returns:
      The environment of the world to create.
    • forcedSpawnPosition

      @AvailableSince("5.7") @NotNull public @NotNull CreateWorldOptions forcedSpawnPosition(@Nullable @Nullable EntityPosition forcedSpawnPosition)
      Sets the forced spawn position of the world to apply. This may be null, in which case the spawn position will be determined by the default generator. Setting spawn position and useSpawnAdjust(boolean) to false will improve world creation speed on PaperMC as chunks will not be loaded to search for spawn point.
      This feature only works on PaperMC 26.1+
      Parameters:
      forcedSpawnPosition - The forced spawn position of the world to create.
      Returns:
      This CreateWorldOptions instance.
      Since:
      5.7
    • forcedSpawnPosition

      @AvailableSince("5.7") @NotNull public @NotNull io.vavr.control.Option<EntityPosition> forcedSpawnPosition()
      Sets the forced spawn position of the world to apply. This may be null, in which case the spawn position will be determined by the default generator.
      This feature only works on PaperMC 26.1+
      Returns:
      The force spawn position to apply if available.
    • generateStructures

      @NotNull public @NotNull CreateWorldOptions generateStructures(boolean generateStructuresInput)
      Sets whether structures such as NPC villages should be generated.
      Parameters:
      generateStructuresInput - Whether structures such as NPC villages should be generated.
      Returns:
      This CreateWorldOptions instance.
    • generateStructures

      public boolean generateStructures()
      Gets whether structures such as NPC villages should be generated.
      Returns:
      Whether structures such as NPC villages should be generated.
    • generator

      @NotNull public @NotNull CreateWorldOptions generator(@Nullable @Nullable String generatorInput)
      Sets the custom generator plugin and its parameters.
      Parameters:
      generatorInput - The custom generator plugin and its parameters.
      Returns:
      This CreateWorldOptions instance.
    • generator

      @Nullable public @Nullable String generator()
      Gets the custom generator plugin and its parameters.
      Returns:
      The custom generator plugin and its parameters.
    • generatorSettings

      @NotNull public @NotNull CreateWorldOptions generatorSettings(@NotNull @NotNull String generatorSettings)
      Sets the generator settings of the world that will be created or loaded.

      Currently only WorldType.FLAT uses these settings, and expects them to be in JSON format with a valid biome (1.18.2 and above) defined. An example valid configuration is as follows: {"layers": [{"block": "stone", "height": 1}, {"block": "grass_block", "height": 1}], "biome":"plains"}

      Parameters:
      generatorSettings - The settings that should be used by the generator
      Returns:
      This object, for chaining
      See Also:
    • generatorSettings

      @NotNull public @NotNull String generatorSettings()
      Gets the generator settings of the world that will be created or loaded.
      Returns:
      The generator settings of the world that will be created or loaded
    • seed

      @NotNull public @NotNull CreateWorldOptions seed(@Nullable @Nullable String seedInput)
      Sets the seed of the world to create. If the seed is a number, it will be parsed as a long. Otherwise, it will be hashed.
      Parameters:
      seedInput - The seed of the world to create.
      Returns:
      This CreateWorldOptions instance.
    • seed

      @NotNull public @NotNull CreateWorldOptions seed(long seedInput)
      Sets the seed of the world to create.
      Parameters:
      seedInput - The seed of the world to create.
      Returns:
      This CreateWorldOptions instance.
    • seed

      public long seed()
      Gets the seed of the world to create.
      Returns:
      The seed of the world to create.
    • useSpawnAdjust

      @NotNull public @NotNull CreateWorldOptions useSpawnAdjust(boolean useSpawnAdjustInput)
      Sets whether multiverse will search for a safe spawn location.
      Parameters:
      useSpawnAdjustInput - Whether multiverse will search for a safe spawn location.
      Returns:
      This CreateWorldOptions instance.
    • useSpawnAdjust

      public boolean useSpawnAdjust()
      Gets whether multiverse will search for a safe spawn location.
      Returns:
      Whether multiverse will search for a safe spawn location.
    • worldType

      @NotNull public @NotNull CreateWorldOptions worldType(@NotNull @NotNull org.bukkit.WorldType worldTypeInput)
      Sets the world type.
      Parameters:
      worldTypeInput - The world type.
      Returns:
      This CreateWorldOptions instance.
    • worldType

      @NotNull public @NotNull org.bukkit.WorldType worldType()
      Gets the world type.
      Returns:
      The world type.
    • doFolderCheck

      @NotNull public @NotNull CreateWorldOptions doFolderCheck(boolean doFolderCheckInput)
      Sets whether to ensure folder does not exist before creating the world.
      Parameters:
      doFolderCheckInput - Whether to do the folder check
      Returns:
      This CreateWorldOptions instance
    • doFolderCheck

      public boolean doFolderCheck()
      Gets whether to ensure folder does not exist before creating the world.
      Returns:
      Whether to do the folder check
    • worldPropertyString

      @AvailableSince("5.5") @NotNull public @NotNull CreateWorldOptions worldPropertyString(@NotNull @NotNull String key, @Nullable @Nullable String value)
      Sets a world property string key-value pair. Overwrites any existing key.
      Parameters:
      key - The key of the world property string.
      value - The value of the world property string.
      Returns:
      This CreateWorldOptions instance.
      Since:
      5.5
    • worldPropertyStrings

      @AvailableSince("5.5") @NotNull public @NotNull CreateWorldOptions worldPropertyStrings(@NotNull @NotNull Map<@NotNull String,@Nullable String> worldProperties)
      Sets multiple world property string key-value pairs. Overwrites any existing keys.
      Parameters:
      worldProperties - A map of world property string key-value pairs.
      Returns:
      This CreateWorldOptions instance.
      Since:
      5.5
    • worldPropertyStrings

      @AvailableSince("5.5") @NotNull public @UnmodifiableView @NotNull Map<String,String> worldPropertyStrings()
      Gets an unmodifiable view of the world property strings. Use worldPropertyString(String, String) and worldPropertyStrings(Map) to modify the world property strings.
      Returns:
      An unmodifiable view of the world property strings.
      Since:
      5.5