程序包 org.bukkit

类 WorldCreator

java.lang.Object
org.bukkit.WorldCreator

public class WorldCreator extends Object
表示可能用于创建一个世界的各种类型的设置。
  • 构造器详细资料

    • WorldCreator

      public WorldCreator(@NotNull @NotNull String name)
      为指定世界的名称创建一个空的WorldCreationOptions类型。

      原文: Creates an empty WorldCreationOptions for the given world name

      参数:
      name - 将被创建的世界的名称
  • 方法详细资料

    • copy

      从指定的世界复制设置。

      原文: Copies the options from the specified world

      参数:
      world - 用于复制设置的世界来源
      返回:
      用于连接的对象
    • copy

      从指定的WorldCreator复制设置。

      原文: Copies the options from the specified WorldCreator

      参数:
      creator - 用于复制设置的世界来源
      返回:
      用于连接的对象
    • name

      @NotNull public @NotNull String name()
      获取被加载或创建的世界的名称。

      原文: Gets the name of the world that is to be loaded or created.

      返回:
      世界名称
    • seed

      public long seed()
      获取用于创建这个世界的种子。

      原文: Gets the seed that will be used to create this world

      返回:
      世界种子
    • seed

      @NotNull public @NotNull WorldCreator seed(long seed)
      设置用于创建这个世界的种子。

      原文: Sets the seed that will be used to create this world

      参数:
      seed - 世界种子
      返回:
      用于连接的对象
    • environment

      @NotNull public World.Environment environment()
      获取用于创建或加载世界的环境。

      原文: Gets the environment that will be used to create or load the world

      返回:
      世界的环境
    • environment

      设置用于创建或加载世界的环境。

      原文: Sets the environment that will be used to create or load the world

      参数:
      env - 世界的环境
      返回:
      用于连接的对象
    • type

      @NotNull public @NotNull WorldType type()
      获取将被创建或加载的世界的类型。

      原文: Gets the type of the world that will be created or loaded

      返回:
      世界的类型
    • type

      设置将被创建或加载的世界的类型。

      原文: Sets the type of the world that will be created or loaded

      参数:
      type - 世界的类型
      返回:
      用于连接的对象
    • generator

      @Nullable public @Nullable ChunkGenerator generator()
      获取用于创建或加载世界的生成器。

      可能为null值,在这种情况下会使用这个环境的"natural"型生成器。

      原文: Gets the generator that will be used to create or load the world.

      This may be null, in which case the "natural" generator for this environment will be used.

      返回:
      区块生成器
    • generator

      设置将被用于创建或加载世界的生成器。

      可能为null值,在这种情况下会使用这个环境的"natural"型生成器。

      原文: Sets the generator that will be used to create or load the world.

      This may be null, in which case the "natural" generator for this environment will be used.

      参数:
      generator - 区块生成器
      返回:
      用于连接的对象
    • generator

      @NotNull public @NotNull WorldCreator generator(@Nullable @Nullable String generator)
      设置将被用于创建或加载世界的生成器。

      可能为null值,在这种情况下会使用这个环境的"natural"型生成器。

      如果找不到指定名字的生成器,就会使用自然环境生成器以代替并且会在控制台上输出一个警告。

      原文: Sets the generator that will be used to create or load the world.

      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 - 使用的生成器的名字,形式为"plugin:id"
      返回:
      用于连接的对象
    • generator

      设置将用于创建或加载的生成器。

      可能为null值,在这种情况下会使用这个环境的"natural"型生成器。

      如果找不到指定名字的生成器,就会使用自然环境生成器以代替并且会在控制台上输出一个警告。

      原文: Sets the generator that will be used to create or load the world.

      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 - 使用的生成器的名字,形式为"plugin:id"
      output - 将用于接受任何错误信息的CommandSender
      返回:
      用于连接的对象
    • biomeProvider

      @Nullable public @Nullable BiomeProvider biomeProvider()
      Gets the biome provider that will be used to create or load the world.

      This may be null, in which case the biome provider from the ChunkGenerator will be used. If no ChunkGenerator is specific the "natural" biome provider for this environment will be used.

      返回:
      Biome provider
    • biomeProvider

      @NotNull public @NotNull WorldCreator biomeProvider(@Nullable @Nullable BiomeProvider biomeProvider)
      Sets the biome provider that will be used to create or load the world.

      This may be null, in which case the biome provider from the ChunkGenerator will be used. If no ChunkGenerator is specific the "natural" biome provider for this environment will be used.

      参数:
      biomeProvider - Biome provider
      返回:
      This object, for chaining
    • biomeProvider

      @NotNull public @NotNull WorldCreator biomeProvider(@Nullable @Nullable String biomeProvider)
      Sets the biome provider that will be used to create or load the world.

      This may be null, in which case the biome provider from the ChunkGenerator will be used. If no ChunkGenerator is specific the "natural" biome provider for this environment will be used.

      If the biome provider cannot be found for the given name and no ChunkGenerator is specific, the natural environment biome provider will be used instead and a warning will be printed to the specified output

      参数:
      biomeProvider - Name of the biome provider to use, in "plugin:id" notation
      返回:
      This object, for chaining
    • biomeProvider

      @NotNull public @NotNull WorldCreator biomeProvider(@Nullable @Nullable String biomeProvider, @Nullable @Nullable CommandSender output)
      Sets the biome provider that will be used to create or load the world.

      This may be null, in which case the biome provider from the ChunkGenerator will be used. If no ChunkGenerator is specific the "natural" biome provider for this environment will be used.

      If the biome provider cannot be found for the given name and no ChunkGenerator is specific, the natural environment biome provider will be used instead and a warning will be printed to the specified output

      参数:
      biomeProvider - Name of the biome provider to use, in "plugin:id" notation
      output - CommandSender that will receive any error messages
      返回:
      This object, for chaining
    • generatorSettings

      @NotNull public @NotNull WorldCreator 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"}

      参数:
      generatorSettings - The settings that should be used by the generator
      返回:
      This object, for chaining
      另请参阅:
    • generatorSettings

      @NotNull public @NotNull String generatorSettings()
      获取将被创建或加载的世界的生成器的配置。

      原文: Gets the generator settings of the world that will be created or loaded

      返回:
      将被使用的生成器的配置
      另请参阅:
    • generateStructures

      @NotNull public @NotNull WorldCreator generateStructures(boolean generate)
      设置被这个生成器创建或加载的世界是否会拥有建筑。

      原文: Sets whether or not worlds created or loaded with this creator will have structures.

      参数:
      generate - 是否生成建筑
      返回:
      用于连接的对象
    • generateStructures

      public boolean generateStructures()
      获取世界是否生成建筑。

      原文: Gets whether or not structures will be generated in the world.

      返回:
      True 如果生成建筑则返回true
    • hardcore

      @NotNull public @NotNull WorldCreator hardcore(boolean hardcore)
      Sets whether the world will be hardcore or not. In a hardcore world the difficulty will be locked to hard.
      参数:
      hardcore - Whether the world will be hardcore
      返回:
      This object, for chaining
    • hardcore

      public boolean hardcore()
      Gets whether the world will be hardcore or not. In a hardcore world the difficulty will be locked to hard.
      返回:
      hardcore status
    • keepSpawnInMemory

      @NotNull public @NotNull WorldCreator keepSpawnInMemory(boolean keepSpawnInMemory)
      Sets whether the spawn chunks will be kept loaded.
      Setting this to false will also stop the spawn chunks from being generated when creating a new world.

      Has little performance benefit unless paired with a ChunkGenerator that overrides ChunkGenerator.getFixedSpawnLocation(World, Random).

      参数:
      keepSpawnInMemory - Whether the spawn chunks will be kept loaded
      返回:
      This object, for chaining
    • keepSpawnInMemory

      public boolean keepSpawnInMemory()
      Gets whether or not the spawn chunks will be kept loaded.
      返回:
      True if the spawn chunks will be kept loaded
    • createWorld

      @Nullable public @Nullable World createWorld()
      使用指定的设置创建一个世界。

      如果世界存在,它就会从磁盘被加载,一些设置可能被忽略。

      原文: Creates a world with the specified options.

      If the world already exists, it will be loaded from disk and some options may be ignored.

      返回:
      最近创建或加载的世界
    • name

      为指定的世界名创建一个新的WorldCreator

      原文: Creates a new WorldCreator for the given world name

      参数:
      name - 加载或创建的世界名
      返回:
      创建的世界生成器
    • getGeneratorForName

      试图使用指定的名称获取ChunkGenerator

      如果生成器找不到,则会返回null并会向指定的CommandSender输出一条信息来解释原因。

      名称的形式必须为"plugin:id"或"plugin"形式,请求的插件的"plugin"为一个插件的安全名称并且"id"是生成器的可选的唯一的标识符。

      原文: Attempts to get the 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 - 检索的生成器的名字
      output - 错误发生时的输出处
      返回:
      若存在则返回获取的生成器,否则返回null
    • getBiomeProviderForName

      @Nullable public static @Nullable BiomeProvider getBiomeProviderForName(@NotNull @NotNull String world, @Nullable @Nullable String name, @Nullable @Nullable CommandSender output)
      Attempts to get the BiomeProvider with the given name.

      If the biome provider 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 biome provider you wish to request from the plugin.

      参数:
      world - Name of the world this will be used for
      name - Name of the biome provider to retrieve
      output - Where to output if errors are present
      返回:
      Resulting biome provider, or null