Class Property

java.lang.Object
me.fami6xx.rpuniverse.core.properties.Property

public class Property extends Object
Represents a property in the RP Universe.
  • Constructor Details

    • Property

      public Property(UUID propertyId)
      Constructs a new Property with the specified property ID.
      Parameters:
      propertyId - the unique identifier for the property
  • Method Details

    • beforeSave

      protected void beforeSave()
      Called before saving the property to the file.

      Makes sure that all the data that needs to be saved is savable.

    • afterLoad

      protected void afterLoad()
      Called after loading the property from the file.

      Makes sure that all the data that needs to be loaded is loaded.

    • deactivate

      protected void deactivate()
      Deactivates the property, deleting the hologram.
    • remove

      protected void remove()
      Removes the property from the server. Doesn't remove the property from file system.

      Includes removal of all associated locks and the hologram.

    • getPropertyId

      public UUID getPropertyId()
      Gets the unique identifier for the property.
      Returns:
      the property ID
    • getLocksUUID

      public List<UUID> getLocksUUID()
      Gets the list of locked blocks associated with the property.
      Returns:
      the list of locked blocks
    • setLockedBlocks

      public void setLockedBlocks(List<UUID> locksUUID)
      Sets the list of locked blocks associated with the property.
      Parameters:
      locksUUID - the new list of locked blocks
    • addLock

      public void addLock(Lock lock)
      Adds a lock to the property.

      Assuming that the lock is not already associated with the property.

      Assuming you've already added the lock to LockHandler.

      Parameters:
      lock - the lock to add
    • removeLock

      public void removeLock(Lock lock)
      Removes a lock from the property.

      Also removes the lock from the LockHandler. Completely deleting it from the server.

      Parameters:
      lock - the lock to remove
    • getHologramLocation

      public org.bukkit.Location getHologramLocation()
      Gets the location of the hologram associated with the property.
      Returns:
      the hologram location
    • setHologramLocation

      public void setHologramLocation(org.bukkit.Location hologramLocation)
      Sets the location of the hologram associated with the property.

      Destroys the current hologram and creates a new one.

      Parameters:
      hologramLocation - the new hologram location
    • isRentable

      public boolean isRentable()
      Checks if the property is rentable.
      Returns:
      true if the property is rentable, false otherwise
    • setRentable

      public void setRentable(boolean rentable)
      Sets whether the property is rentable.
      Parameters:
      rentable - true if the property should be rentable, false otherwise
    • getPrice

      public double getPrice()
      Gets the price of the property.
      Returns:
      the price of the property
    • setPrice

      public void setPrice(double price)
      Sets the price of the property.
      Parameters:
      price - the new price of the property
    • getRentDuration

      public long getRentDuration()
      Gets the rent duration of the property in milliseconds.
      Returns:
      the rent duration in milliseconds
    • setRentDuration

      public void setRentDuration(long rentDuration)
      Sets the rent duration of the property in milliseconds.
      Parameters:
      rentDuration - the new rent duration in milliseconds
    • getOwner

      public UUID getOwner()
      Gets the owner of the property.
      Returns:
      the owner UUID
    • setOwner

      public void setOwner(UUID owner)
      Sets the owner of the property and updates the last active timestamp.
      Parameters:
      owner - the new owner UUID
    • getTrustedPlayers

      public List<UUID> getTrustedPlayers()
      Gets the list of trusted players for the property.
      Returns:
      the list of trusted players
    • setTrustedPlayers

      public void setTrustedPlayers(List<UUID> trustedPlayers)
      Sets the list of trusted players for the property.
      Parameters:
      trustedPlayers - the new list of trusted players
    • addTrustedPlayer

      public void addTrustedPlayer(UUID playerUUID)
      Adds a player to the list of trusted players.
      Parameters:
      playerUUID - the UUID of the player to add
    • removeTrustedPlayer

      public void removeTrustedPlayer(UUID playerUUID)
      Removes a player from the list of trusted players.
      Parameters:
      playerUUID - the UUID of the player to remove
    • getLastActive

      public long getLastActive()
      Gets the last active timestamp of the property.
      Returns:
      the last active timestamp in milliseconds
    • updateLastActive

      public void updateLastActive()
      Updates the last active timestamp to the current time.
    • isAvailable

      public boolean isAvailable()
      Checks if the property is available (i.e., has no owner).
      Returns:
      true if the property is available, false otherwise
    • getRentStart

      public long getRentStart()
      Gets the start timestamp of the rent.
      Returns:
      the start timestamp of the rent in milliseconds
    • setRentStart

      public void setRentStart(long rentStart)
      Sets the start timestamp of the rent.
      Parameters:
      rentStart - the new start timestamp of the rent in milliseconds
    • getRentMaximumDuration

      public long getRentMaximumDuration()
      Gets the maximum duration of the rent.
      Returns:
      the maximum duration of the rent in milliseconds
    • setRentMaximumDuration

      public void setRentMaximumDuration(long rentMaximumDuration)
      Sets the maximum duration of the rent.
      Parameters:
      rentMaximumDuration - the new maximum duration of the rent in milliseconds
    • getAssociatedLocks

      public List<Lock> getAssociatedLocks()
      Gets the associated locks of the property.
      Returns:
      the associated locks