Class BlockLevelLimit

java.lang.Object
com.ryandw11.structure.structure.properties.BlockLevelLimit

public class BlockLevelLimit extends Object
Handles the block level limit of the StructureLimitations property.

This setting can have multiple modes. The following are valid modes: flat, flat_error flat - The ground must not be air in the cube region while the blocks above the ground must be air or plants.

flat_error - Same as flat; however, a certain error is acceptable. So if the error is set to 0.33 than it has a 1/3 error allowance. Error is calculated by (error_blocks/total_block) if (total_error > allowed_error) than the structure does not spawn. See logic in StructurePicker for more details.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a BlockLevelLimit that has no mode.
    BlockLevelLimit​(String mode, int x1, int z1, int x2, int z2)
    Create a block level limit.
    BlockLevelLimit​(org.bukkit.configuration.file.FileConfiguration fileConfiguration)
    Create the BlockLevelLimit from a config file.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Get the error of the level limit.
    Get the mode of the block level limit.
    int
    Get the first x.
    int
    Get the second x.
    int
    Get the first z.
    int
    Get the second z.
    boolean
    If Block Level Limit is enabled.
    void
    setError​(double error)
    Set the error for the level limit.
    void
    setMode​(String mode)
    Set the mode of the block level limit.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BlockLevelLimit

      public BlockLevelLimit(String mode, int x1, int z1, int x2, int z2)
      Create a block level limit.
      Parameters:
      mode - The mode.
      x1 - The first x.
      z1 - The first z.
      x2 - The second x.
      z2 - The second z.
    • BlockLevelLimit

      public BlockLevelLimit()
      Create a BlockLevelLimit that has no mode.
    • BlockLevelLimit

      public BlockLevelLimit(org.bukkit.configuration.file.FileConfiguration fileConfiguration)
      Create the BlockLevelLimit from a config file.
      Parameters:
      fileConfiguration - The configuration file.
  • Method Details

    • isEnabled

      public boolean isEnabled()
      If Block Level Limit is enabled.
      Returns:
      If the block level limit is enabled.
    • getError

      public double getError()
      Get the error of the level limit.

      The error configuration is only used by the flat_error mode. This value will be -1 for all other modes.

      Returns:
      The error of the level limit.
    • setError

      public void setError(double error)
      Set the error for the level limit.

      This is only used by the flat_error mode.

      Parameters:
      error - The error of the level limit.

      This is a percent is decimal form. (0-1) only.

    • getMode

      public String getMode()
      Get the mode of the block level limit.
      Returns:
      The mode.
    • setMode

      public void setMode(String mode)
      Set the mode of the block level limit.
      Parameters:
      mode - The mode of the block level limit. ('none' or 'flat_error').
    • getX1

      public int getX1()
      Get the first x.
      Returns:
      The first x.
    • getX2

      public int getX2()
      Get the second x.
      Returns:
      The second x.
    • getZ1

      public int getZ1()
      Get the first z.
      Returns:
      The first z.
    • getZ2

      public int getZ2()
      Get the second z.
      Returns:
      The second z.