Class Region

java.lang.Object
ml.karmaconfigs.api.bukkit.region.Cuboid
ml.karmaconfigs.api.bukkit.region.Region
All Implemented Interfaces:
Serializable

public class Region extends Cuboid implements Serializable
Karma region
See Also:
Serialized Form
  • Constructor Details

    • Region

      public Region(KarmaPlugin owner, String n, org.bukkit.Location point1, org.bukkit.Location point2) throws IllegalArgumentException
      Initialize the region
      Parameters:
      owner - the region owner
      n - the region name
      point1 - the first point
      point2 - 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

      public UUID getUniqueId()
      Get the region unique id
      Specified by:
      getUniqueId in class Cuboid
      Returns:
      the region unique id
    • getName

      public String getName()
      Get the region name
      Specified by:
      getName in class Cuboid
      Returns:
      the region name
    • getInternalName

      public String getInternalName()
      Get the region internal name
      Specified by:
      getInternalName in class Cuboid
      Returns:
      the region internal name
    • exists

      public boolean exists(KarmaPlugin owner)
      Get if the region already exists
      Specified by:
      exists in class Cuboid
      Parameters:
      owner - the region owner
      Returns:
      if the region already exists
    • getBlocks

      public Iterator<org.bukkit.block.Block> getBlocks()
      Get the region blocks
      Specified by:
      getBlocks in class Cuboid
      Returns:
      the region blocks
    • getCenter

      public org.bukkit.Location getCenter()
      Get the region center location
      Specified by:
      getCenter in class Cuboid
      Returns:
      the region center location
    • getSize

      public double getSize()
      Get the region size
      Specified by:
      getSize in class Cuboid
      Returns:
      the region size
    • getSizeSquared

      public double getSizeSquared()
      Get the region size
      Specified by:
      getSizeSquared in class Cuboid
      Returns:
      the region size
    • getTop

      public org.bukkit.Location getTop()
      Get the top location
      Specified by:
      getTop in class Cuboid
      Returns:
      the top location
    • getBottom

      public org.bukkit.Location getBottom()
      Get the bottom location
      Specified by:
      getBottom in class Cuboid
      Returns:
      the bottom location
    • getWorld

      public org.bukkit.World getWorld()
      Get the region world
      Specified by:
      getWorld in class Cuboid
      Returns:
      the region world
    • getBlocksAmount

      public int getBlocksAmount()
      Get the amount of blocks inside the region
      Specified by:
      getBlocksAmount in class Cuboid
      Returns:
      the region blocks
    • getHeight

      public int getHeight()
      Get the region height
      Specified by:
      getHeight in class Cuboid
      Returns:
      the region height
    • getWidth

      public int getWidth()
      Get the region width
      Specified by:
      getWidth in class Cuboid
      Returns:
      the region width
    • getLength

      public int getLength()
      Get the region length
      Specified by:
      getLength in class Cuboid
      Returns:
      the region length
    • isInside

      public boolean isInside(org.bukkit.entity.Entity entity)
      Get if the entity is inside the region
      Specified by:
      isInside in class Cuboid
      Parameters:
      entity - the entity
      Returns:
      if the entity is inside the region
    • isInside

      public boolean isInside(org.bukkit.block.Block block)
      Get if the block is inside the region
      Specified by:
      isInside in class Cuboid
      Parameters:
      block - the block
      Returns:
      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
      Specified by:
      isInside in class Cuboid
      Parameters:
      entity - the entity
      marge - the marge out of region frontier
      Returns:
      if the entity is inside the region
    • getToken

      public String 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

      Specified by:
      getToken in class Cuboid
      Returns:
      the region token
    • getTopCorners

      public Corner getTopCorners()
      Get the top corners of the region
      Specified by:
      getTopCorners in class Cuboid
      Returns:
      the top region corners
    • getBottomCorners

      public Corner getBottomCorners()
      Get the bottom corners of the region
      Specified by:
      getBottomCorners in class Cuboid
      Returns:
      the bottom region corners
    • getWalls

      public Wall getWalls(WallType type)
      Get the region walls
      Specified by:
      getWalls in class Cuboid
      Parameters:
      type - the wall type
      Returns:
      the region walls
    • saveToMemory

      public void saveToMemory(KarmaPlugin owner)
      Save the region to memory
      Specified by:
      saveToMemory in class Cuboid
      Parameters:
      owner - the region owner
    • fromMemory

      public static Region fromMemory(KarmaPlugin owner, String token) throws RegionNotFound
      Load the region from the memory location
      Parameters:
      owner - the region owner
      token - the region token
      Returns:
      the region
      Throws:
      RegionNotFound - if the region couldn't be loaded