Interface StructureSection


public interface StructureSection
This interface is used to add custom configuration sections to the plugin.

StructureSections require a CustomStructureAddon class to be registered with the API using the CustomStructuresAPI.registerCustomAddon(CustomStructureAddon) method.

Note: Your implementation must have a public default constructor with no parameters. That default constructor should initialize your section with the default values. A second constructor for developers using your custom section is optional.

The getName() method must have a YAML friendly name. Ensure that your name is unique and does not interfere with any other sections. It is recommended that you do the following naming convention to make it easy for users:

{AddonName}MyCoolSection
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    checkStructureConditions​(Structure structure, org.bukkit.block.Block spawnBlock, org.bukkit.Chunk chunk)
    This method informs the plugin if the structure can spawn.
    This is the name of your custom section.
    void
    setupSection​(@Nullable org.bukkit.configuration.ConfigurationSection configurationSection)
    This method is called when a structure is loaded from the plugin's structure folder.
  • Method Details

    • getName

      String getName()
      This is the name of your custom section.
      Returns:
      The name of your custom section.
    • setupSection

      void setupSection(@Nullable @Nullable org.bukkit.configuration.ConfigurationSection configurationSection)
      This method is called when a structure is loaded from the plugin's structure folder.

      This method is not called when another plugin adds your section via the StructureBuilder. So it is important that your default constructor initializes your section with the default values.

      Parameters:
      configurationSection - The configuration section. (This is null if the section does not exist in the structure configuration file).
    • checkStructureConditions

      boolean checkStructureConditions(Structure structure, org.bukkit.block.Block spawnBlock, org.bukkit.Chunk chunk)
      This method informs the plugin if the structure can spawn.
      Parameters:
      structure - The structure that is being spawned. (Note: it is good practice to not rely on other data from the structure to make a decision.)
      spawnBlock - The spawn block.
      chunk - The spawn chunk.
      Returns:
      If the structure can spawn. (True means it can, false means it can't).