Class WorldGenerators

java.lang.Object
ua.mcchickenstudio.opencreative.utils.world.generators.WorldGenerators

public final class WorldGenerators extends Object

WorldGenerators

This class represents world generators registry, that contains all generators, that can be used for creating or loading worlds.

To add your own world generator, create a class, that extends WorldGenerator or AbstractFlatGenerator, then register it with registerWorldGenerator(WorldGenerator) method.

  • Constructor Details

    • WorldGenerators

      public WorldGenerators()
  • Method Details

    • getInstance

      @NotNull public static @NotNull WorldGenerators getInstance()
      Returns instance of world generators controller class.
      Returns:
      instance of world generators.
    • registerWorldGenerator

      public void registerWorldGenerator(@NotNull @NotNull WorldGenerator generator)
      Registers world generator, that can be used for world generation.
      Parameters:
      generator - world generator to register.
    • registerWorldGenerator

      public void registerWorldGenerator(@NotNull @NotNull WorldGenerator... generator)
      Registers world generators, that can be used for world generation.
      Parameters:
      generator - world generators to register.
    • unregisterWorldGenerator

      public void unregisterWorldGenerator(@NotNull @NotNull WorldGenerator generator)
      Unregisters world generator if list contains it.
      Parameters:
      generator - world generator to unregister.
    • clearWorldGenerators

      public void clearWorldGenerators()
      Unregisters all world generators.
    • getWorldGenerators

      @NotNull public @NotNull List<WorldGenerator> getWorldGenerators()
      Returns a copy of list that contains all registered world generators.
      Returns:
      world generators list.
    • getGeneratorsIDs

      @NotNull public @NotNull List<Object> getGeneratorsIDs()
      Returns a list of all registered generators IDs.
      Returns:
      generators ID list.
    • getGeneratorsMaterials

      @NotNull public @NotNull List<org.bukkit.Material> getGeneratorsMaterials()
      Returns a list of all registered generators materials.
      Returns:
      generators materials list.
    • getById

      @Nullable public @Nullable WorldGenerator getById(@NotNull @NotNull String id)
      Returns world generator from registry by specified id if it exists, otherwise will return null.
      Parameters:
      id - id to get world generator.
      Returns:
      world generator - if exists, or null - not exists.