Class PSMergedRegion

java.lang.Object
dev.espi.protectionstones.PSRegion
dev.espi.protectionstones.PSMergedRegion

public class PSMergedRegion extends PSRegion
Represents an instance of a PS region that has been merged into another region. There is no actual WG region that this contains, and instead takes properties from its parent region (see PSGroupRegion).
  • Method Details

    • getMergedRegion

      public static PSMergedRegion getMergedRegion(org.bukkit.Location l)
      Finds the PSMergedRegion at a location if the block at that location is the source protection block for it.
      Parameters:
      l - location to look at
      Returns:
      the PSMergedRegion of the source block location, or null if not applicable
    • getGroupRegion

      public PSGroupRegion getGroupRegion()
      Get the group region that contains this region.
      Returns:
      the group region
    • getId

      public String getId()
      Description copied from class: PSRegion
      Get the WorldGuard ID of the region. Note that this is not guaranteed to be unique between worlds.
      Specified by:
      getId in class PSRegion
      Returns:
      the id of the region
    • getName

      public String getName()
      Description copied from class: PSRegion
      Get the name (nickname) of the region from /ps name.
      Specified by:
      getName in class PSRegion
      Returns:
      the name of the region, or null if the region does not have a name
    • setName

      public void setName(String name)
      Description copied from class: PSRegion
      Set the name of the region (from /ps name).
      Specified by:
      setName in class PSRegion
      Parameters:
      name - new name, or null to remove the name
    • setParent

      public void setParent(PSRegion r) throws com.sk89q.worldguard.protection.regions.ProtectedRegion.CircularInheritanceException
      Description copied from class: PSRegion
      Set the parent of this region.
      Specified by:
      setParent in class PSRegion
      Parameters:
      r - the region to be the parent, or null for no parent
      Throws:
      com.sk89q.worldguard.protection.regions.ProtectedRegion.CircularInheritanceException - thrown when the parent already inherits from the child
    • getParent

      public PSRegion getParent()
      Description copied from class: PSRegion
      Get the parent of this region, if there is one.
      Specified by:
      getParent in class PSRegion
      Returns:
      the parent of the region, or null if there isn't one
    • getHome

      public org.bukkit.Location getHome()
      Description copied from class: PSRegion
      Get the location of the set home the region has (for /ps tp).
      Specified by:
      getHome in class PSRegion
      Returns:
      the location of the home, or null if the ps_home flag is not set.
    • setHome

      public void setHome(double blockX, double blockY, double blockZ)
      Description copied from class: PSRegion
      Set the home of the region (internally changes the flag).
      Specified by:
      setHome in class PSRegion
      Parameters:
      blockX - block x location
      blockY - block y location
      blockZ - block z location
    • setHome

      public void setHome(double blockX, double blockY, double blockZ, float yaw, float pitch)
      Description copied from class: PSRegion
      Set the home of the region (internally changes the flag).
      Specified by:
      setHome in class PSRegion
      Parameters:
      blockX - block x location
      blockY - block y location
      blockZ - block z location
      yaw - location yaw
      pitch - location pitch
    • forSale

      public boolean forSale()
      Specified by:
      forSale in class PSRegion
      Returns:
      whether or not the region is for sale
    • setSellable

      public void setSellable(boolean forSale, UUID landlord, double price)
      Description copied from class: PSRegion
      MUST BE CALLED when setting up the region to be sold or cancelling sale
      Specified by:
      setSellable in class PSRegion
      Parameters:
      forSale - whether or not the region is for sale
      landlord - the owner of the region
      price - the price to sell for
    • sell

      public void sell(UUID player)
      Description copied from class: PSRegion
      Sells the region to a player at the price listed.
      Specified by:
      sell in class PSRegion
      Parameters:
      player - player to transfer the region to
    • getRentStage

      public PSRegion.RentStage getRentStage()
      Specified by:
      getRentStage in class PSRegion
      Returns:
      get the stage of the renting process
    • getLandlord

      public UUID getLandlord()
      Description copied from class: PSRegion
      Get the landlord of the region.
      Specified by:
      getLandlord in class PSRegion
      Returns:
      returns the UUID of the landlord, or null if there is none.
    • setLandlord

      public void setLandlord(UUID landlord)
      Description copied from class: PSRegion
      Set the landlord of the region.
      Specified by:
      setLandlord in class PSRegion
      Parameters:
      landlord - uuid of landlord, or null to remove
    • getTenant

      public UUID getTenant()
      Description copied from class: PSRegion
      Get the tenant of the region.
      Specified by:
      getTenant in class PSRegion
      Returns:
      returns the UUID of the tenant, or null if there is none.
    • setTenant

      public void setTenant(UUID tenant)
      Description copied from class: PSRegion
      Set the tenant of the region
      Specified by:
      setTenant in class PSRegion
      Parameters:
      tenant - uuid of tenant, or null to remove
    • getRentPeriod

      public String getRentPeriod()
      Description copied from class: PSRegion
      Get the rent period of the region
      Specified by:
      getRentPeriod in class PSRegion
      Returns:
      returns the rent duration, or null if there is none
    • setRentPeriod

      public void setRentPeriod(String s)
      Description copied from class: PSRegion
      Set the rent period of the region
      Specified by:
      setRentPeriod in class PSRegion
      Parameters:
      s - the duration between rent payments (d h m s), or null to remove
    • getPrice

      public Double getPrice()
      Description copied from class: PSRegion
      Get the price of the region This applies to either the rent or the full purchase of a region.
      Specified by:
      getPrice in class PSRegion
      Returns:
      the price of the region during rent payments, or null if there is no rent
    • setPrice

      public void setPrice(Double price)
      Description copied from class: PSRegion
      Set the price of the region. This applies to either the rent or the full purchase of a region.
      Specified by:
      setPrice in class PSRegion
      Parameters:
      price - the price of the region, or null if there is no rent
    • setRentLastPaid

      public void setRentLastPaid(Long timestamp)
      Description copied from class: PSRegion
      Set the unix timestamp of when rent was last paid.
      Specified by:
      setRentLastPaid in class PSRegion
      Parameters:
      timestamp - the unix timestamp of when rent was last paid, or null
    • getRentLastPaid

      public Long getRentLastPaid()
      Description copied from class: PSRegion
      Get the unix timestamp of when rent was last paid.
      Specified by:
      getRentLastPaid in class PSRegion
      Returns:
      the unix timestamp of when rent was last paid, or null if not renting
    • setRentable

      public void setRentable(UUID landlord, String rentPeriod, double rentPrice)
      Description copied from class: PSRegion
      MUST BE CALLED when the region is looking for a tenant.
      Specified by:
      setRentable in class PSRegion
      Parameters:
      landlord - the landlord of the region
      rentPeriod - the rent period (d h m s) of the region
      rentPrice - the price to charge during each rent payment
    • rentOut

      public void rentOut(UUID landlord, UUID tenant, String rentPeriod, double rentPrice)
      Description copied from class: PSRegion
      Starts renting process (adds to rent queue) tenant. MUST BE CALLED when renting the region out to a tenant.
      Specified by:
      rentOut in class PSRegion
      Parameters:
      landlord - the landlord of the region
      tenant - the tenant of the region
      rentPeriod - the rent period (d h m s) of the region
      rentPrice - the price to charge during each rent payment
    • removeRenting

      public void removeRenting()
      Description copied from class: PSRegion
      Stop renting process and remove tenant. MUST BE CALLED when removing rent.
      Specified by:
      removeRenting in class PSRegion
    • getTaxPeriod

      public String getTaxPeriod()
      Description copied from class: PSRegion
      Get the formatted period(s) between tax payments for this region type. If you simply wanted the number of seconds, use getTypeOptions().taxPeriod
      Specified by:
      getTaxPeriod in class PSRegion
      Returns:
      the duration between tax payments, or multiple if there are several different ones
    • getTaxPaymentPeriod

      public String getTaxPaymentPeriod()
      Description copied from class: PSRegion
      Get the formatted period(s) allowed for the payment of tax. If you simply wanted the number of seconds, use getTypeOptions().taxPaymentTime
      Specified by:
      getTaxPaymentPeriod in class PSRegion
      Returns:
      the duration of time allowed to pay a tax, or multiple if there are several different ones
    • getTaxPaymentsDue

      public List<PSRegion.TaxPayment> getTaxPaymentsDue()
      Description copied from class: PSRegion
      Get the list of tax payments that are due.
      Specified by:
      getTaxPaymentsDue in class PSRegion
      Returns:
      the list of tax payments outstanding
    • setTaxPaymentsDue

      public void setTaxPaymentsDue(List<PSRegion.TaxPayment> taxPayments)
      Description copied from class: PSRegion
      Save the list of tax payments due onto the region.
      Specified by:
      setTaxPaymentsDue in class PSRegion
      Parameters:
      taxPayments - the full list of tax payments that are due
    • getRegionLastTaxPaymentAddedEntries

      public List<PSRegion.LastRegionTaxPaymentEntry> getRegionLastTaxPaymentAddedEntries()
      Description copied from class: PSRegion
      Get the list of timestamps of the last time regions and sub regions have added to the tax payments list.
      Specified by:
      getRegionLastTaxPaymentAddedEntries in class PSRegion
      Returns:
      the list of the last time regions and sub regions have added to the tax payment list
    • setRegionLastTaxPaymentAddedEntries

      public void setRegionLastTaxPaymentAddedEntries(List<PSRegion.LastRegionTaxPaymentEntry> entries)
      Description copied from class: PSRegion
      Save the list of timestamps of the last time regions and sub regions have added to the tax payments list on to the base region.
      Specified by:
      setRegionLastTaxPaymentAddedEntries in class PSRegion
      Parameters:
      entries - the full list of PSRegion.LastRegionTaxPaymentEntry entries.
    • getTaxAutopayer

      public UUID getTaxAutopayer()
      Description copied from class: PSRegion
      Get the player that is set to autopay the tax amount.
      Specified by:
      getTaxAutopayer in class PSRegion
      Returns:
      the player that is set as the autopayer, or null if no player is set
    • setTaxAutopayer

      public void setTaxAutopayer(UUID uuid)
      Description copied from class: PSRegion
      Set a player to auto-pay taxes for this region.
      Specified by:
      setTaxAutopayer in class PSRegion
      Parameters:
      uuid - the player to use to auto-pay taxes
    • payTax

      public net.milkbowl.vault.economy.EconomyResponse payTax(PSPlayer p, double amount)
      Description copied from class: PSRegion
      Pay outstanding taxes. It will only withdraw the amount required to pay the taxes, and will take up to the amount specified if the outstanding payments are larger.
      Specified by:
      payTax in class PSRegion
      Parameters:
      p - the player to take money from
      amount - the amount to take
      Returns:
      the EconomyResponse returned by Vault
    • isTaxPaymentLate

      public boolean isTaxPaymentLate()
      Description copied from class: PSRegion
      Check if any tax payments are now late (exceeded tax payment time shown in config).
      Specified by:
      isTaxPaymentLate in class PSRegion
      Returns:
      whether or not any tax payments are now late
    • updateTaxPayments

      public void updateTaxPayments()
      Description copied from class: PSRegion
      Update with the current time and calculate any tax payments that are now due.
      Specified by:
      updateTaxPayments in class PSRegion
    • getProtectBlock

      public org.bukkit.block.Block getProtectBlock()
      Description copied from class: PSRegion
      This method returns the block that is supposed to contain the protection block. Warning: If the protection stone is hidden, this will give the block that took its place!
      Specified by:
      getProtectBlock in class PSRegion
      Returns:
      returns the block that may contain the protection stone
    • getTypeOptions

      public PSProtectBlock getTypeOptions()
      Specified by:
      getTypeOptions in class PSRegion
      Returns:
      returns the type, or null if the type is not configured
    • getType

      public String getType()
      Specified by:
      getType in class PSRegion
      Returns:
      returns the protect block type (may include custom player heads PLAYER_HEAD:playername) that the region is
    • setType

      public void setType(PSProtectBlock type)
      Description copied from class: PSRegion
      Change the type of the protection region.
      Overrides:
      setType in class PSRegion
      Parameters:
      type - the type of protection region to switch to
    • isOwner

      public boolean isOwner(UUID uuid)
      Description copied from class: PSRegion
      Get whether or not a player is an owner of this region.
      Specified by:
      isOwner in class PSRegion
      Parameters:
      uuid - the player's uuid
      Returns:
      whether or not the player is a member
    • isMember

      public boolean isMember(UUID uuid)
      Description copied from class: PSRegion
      Get whether or not a player is a member of this region.
      Specified by:
      isMember in class PSRegion
      Parameters:
      uuid - the player's uuid
      Returns:
      whether or not the player is a member
    • getOwners

      public ArrayList<UUID> getOwners()
      Specified by:
      getOwners in class PSRegion
      Returns:
      returns a list of the owners of the protected region
    • getMembers

      public ArrayList<UUID> getMembers()
      Specified by:
      getMembers in class PSRegion
      Returns:
      returns a list of the members of the protected region
    • addOwner

      public void addOwner(UUID uuid)
      Description copied from class: PSRegion
      Add an owner to the region.
      Specified by:
      addOwner in class PSRegion
      Parameters:
      uuid - the uuid of the player to add
    • addMember

      public void addMember(UUID uuid)
      Description copied from class: PSRegion
      Add a member to the region.
      Specified by:
      addMember in class PSRegion
      Parameters:
      uuid - the uuid of the player to add
    • removeOwner

      public void removeOwner(UUID uuid)
      Description copied from class: PSRegion
      Remove an owner of the region, and deal with side-effects. Examples of side-effects: removing player as landlord, removing player as auto taxpayer
      Specified by:
      removeOwner in class PSRegion
      Parameters:
      uuid - the uuid of the player to remove
    • removeMember

      public void removeMember(UUID uuid)
      Description copied from class: PSRegion
      Remove a member of the region, and deal with side-effects
      Specified by:
      removeMember in class PSRegion
      Parameters:
      uuid - the uuid of the player to remove
    • getPoints

      public List<com.sk89q.worldedit.math.BlockVector2> getPoints()
      Specified by:
      getPoints in class PSRegion
      Returns:
      returns a list of the bounding points of the protected region
    • getMergeableRegions

      public List<PSRegion> getMergeableRegions(org.bukkit.entity.Player p)
      Description copied from class: PSRegion
      Get a list of regions that the current region can merge into, taking into account a player's permissions.
      Specified by:
      getMergeableRegions in class PSRegion
      Parameters:
      p - the player to compare permissions with
      Returns:
      the list of regions that the current region can merge into
    • deleteRegion

      public boolean deleteRegion(boolean deleteBlock)
      Description copied from class: PSRegion
      Deletes the region forever. Can be cancelled by event cancellation.
      Specified by:
      deleteRegion in class PSRegion
      Parameters:
      deleteBlock - whether or not to also set the protection block to air (if not hidden)
      Returns:
      whether or not the region was able to be successfully removed
    • deleteRegion

      public boolean deleteRegion(boolean deleteBlock, org.bukkit.entity.Player cause)
      Description copied from class: PSRegion
      Deletes the region forever. Can be cancelled by event cancellation.
      Specified by:
      deleteRegion in class PSRegion
      Parameters:
      deleteBlock - whether or not to also set the protection block to air (if not hidden)
      cause - the player that caused the region to break
      Returns:
      whether or not the region was able to be successfully removed
    • getWGRegion

      public com.sk89q.worldguard.protection.regions.ProtectedRegion getWGRegion()
      Specified by:
      getWGRegion in class PSRegion
      Returns:
      returns the WorldGuard region object directly