Class Region
java.lang.Object
ml.karmaconfigs.api.bukkit.region.Cuboid
ml.karmaconfigs.api.bukkit.region.Region
- All Implemented Interfaces:
Serializable
Karma region
- See Also:
- Serialized Form
-
Constructor Summary
ConstructorsConstructorDescriptionRegion(KarmaPlugin owner, String n, org.bukkit.Location point1, org.bukkit.Location point2)Initialize the region -
Method Summary
Modifier and TypeMethodDescriptionbooleanexists(KarmaPlugin owner)Get if the region already existsstatic RegionfromMemory(KarmaPlugin owner, String token)Load the region from the memory locationIterator<org.bukkit.block.Block>Get the region blocksintGet the amount of blocks inside the regionorg.bukkit.LocationGet the bottom locationGet the bottom corners of the regionorg.bukkit.LocationGet the region center locationintGet the region heightGet the region internal nameintGet the region lengthgetName()Get the region namedoublegetSize()Get the region sizedoubleGet the region sizegetToken()Get the region token, this is another unique identifier for the region ( UUID is also used as identifier ).org.bukkit.LocationgetTop()Get the top locationGet the top corners of the regionGet the region unique idGet the region wallsintgetWidth()Get the region widthorg.bukkit.WorldgetWorld()Get the region worldbooleanisInside(org.bukkit.block.Block block)Get if the block is inside the regionbooleanisInside(org.bukkit.entity.Entity entity)Get if the entity is inside the regionbooleanisInside(org.bukkit.entity.Entity entity, double marge)Get if the entity is inside the regionvoidsaveToMemory(KarmaPlugin owner)Save the region to memoryMethods inherited from class ml.karmaconfigs.api.bukkit.region.Cuboid
getRegions
-
Constructor Details
-
Region
public Region(KarmaPlugin owner, String n, org.bukkit.Location point1, org.bukkit.Location point2) throws IllegalArgumentExceptionInitialize the region- Parameters:
owner- the region ownern- the region namepoint1- the first pointpoint2- the second point- Throws:
IllegalArgumentException- if the locations doesn't have the same world or if any of the worlds are null
-
-
Method Details
-
getUniqueId
Get the region unique id- Specified by:
getUniqueIdin classCuboid- Returns:
- the region unique id
-
getName
Get the region name -
getInternalName
Get the region internal name- Specified by:
getInternalNamein classCuboid- Returns:
- the region internal name
-
exists
Get if the region already exists -
getBlocks
Get the region blocks -
getCenter
public org.bukkit.Location getCenter()Get the region center location -
getSize
public double getSize()Get the region size -
getSizeSquared
public double getSizeSquared()Get the region size- Specified by:
getSizeSquaredin classCuboid- Returns:
- the region size
-
getTop
public org.bukkit.Location getTop()Get the top location -
getBottom
public org.bukkit.Location getBottom()Get the bottom location -
getWorld
public org.bukkit.World getWorld()Get the region world -
getBlocksAmount
public int getBlocksAmount()Get the amount of blocks inside the region- Specified by:
getBlocksAmountin classCuboid- Returns:
- the region blocks
-
getHeight
public int getHeight()Get the region height -
getWidth
public int getWidth()Get the region width -
getLength
public int getLength()Get the region length -
isInside
public boolean isInside(org.bukkit.entity.Entity entity)Get if the entity is inside the region -
isInside
public boolean isInside(org.bukkit.block.Block block)Get if the block is inside the region -
isInside
public boolean isInside(org.bukkit.entity.Entity entity, double marge)Get if the entity is inside the region -
getToken
Get the region token, this is another unique identifier for the region ( UUID is also used as identifier ).The difference between this one and UUID one is that this token is randomly generated, and UUID name-base generated
-
getTopCorners
Get the top corners of the region- Specified by:
getTopCornersin classCuboid- Returns:
- the top region corners
-
getBottomCorners
Get the bottom corners of the region- Specified by:
getBottomCornersin classCuboid- Returns:
- the bottom region corners
-
getWalls
Get the region walls -
saveToMemory
Save the region to memory- Specified by:
saveToMemoryin classCuboid- Parameters:
owner- the region owner
-
fromMemory
Load the region from the memory location- Parameters:
owner- the region ownertoken- the region token- Returns:
- the region
- Throws:
RegionNotFound- if the region couldn't be loaded
-