Class BlockLevelLimit
java.lang.Object
com.ryandw11.structure.structure.properties.BlockLevelLimit
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
ConstructorDescriptionCreate 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 TypeMethodDescriptiondouble
getError()
Get the error of the level limit.getMode()
Get the mode of the block level limit.int
getX1()
Get the first x.int
getX2()
Get the second x.int
getZ1()
Get the first z.int
getZ2()
Get the second z.boolean
If Block Level Limit is enabled.void
setError(double error)
Set the error for the level limit.void
Set the mode of the block level limit.
-
Constructor Details
-
BlockLevelLimit
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
Get the mode of the block level limit.- Returns:
- The mode.
-
setMode
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.
-