Class RegionMember

java.lang.Object
me.tayebyassine.homestead.models.RegionMember

public final class RegionMember extends Object
Represents a player's membership within a region or sub-area.

A member is linked to either a RegionMember.LinkageType.REGION or a RegionMember.LinkageType.SUBAREA and carries its own player and control flag bitmasks, join timestamp, and tax tracking timestamp.

  • Constructor Details

    • RegionMember

      public RegionMember(org.bukkit.OfflinePlayer player, RegionMember.LinkageType type, long linkageId)
      Create a member from a Bukkit player.
      Parameters:
      player - the player
      type - the linkage type
      linkageId - the region or sub-area ID
    • RegionMember

      public RegionMember(UUID playerId, RegionMember.LinkageType type, long linkageId)
      Create a member with a generated snowflake ID.
      Parameters:
      playerId - the player UUID
      type - the linkage type
      linkageId - the region or sub-area ID
    • RegionMember

      public RegionMember(long id, UUID playerId, RegionMember.LinkageType type, long linkageId, long playerFlags, long controlFlags, long taxesAt, long joinedAt)
      Create a member from pre-existing data (deserialization).
      Parameters:
      id - the snowflake ID
      playerId - the player UUID
      type - the linkage type
      linkageId - the region or sub-area ID
      playerFlags - the player flags
      controlFlags - the control flags
      taxesAt - the tax tracking timestamp
      joinedAt - the join timestamp
  • Method Details

    • getUniqueId

      public long getUniqueId()
      Get the unique snowflake ID.
      Returns:
      the member ID
    • getPlayerId

      @NotNull public @NotNull UUID getPlayerId()
      Get the member's UUID.
      Returns:
      the player UUID
    • setPlayerId

      public void setPlayerId(@NotNull @NotNull UUID playerId)
      Set the member's UUID.
      Parameters:
      playerId - the new player UUID
    • getPlayer

      @Nullable public @Nullable org.bukkit.OfflinePlayer getPlayer()
      Get the member as an offline player.
      Returns:
      the player, or null if not found
    • setPlayer

      public void setPlayer(@NotNull @NotNull org.bukkit.OfflinePlayer player)
      Set the member player.
      Parameters:
      player - the new player
    • getPlayerName

      @NotNull public @NotNull String getPlayerName()
      Get the member's name safely. Returns "?" if not found.
      Returns:
      the player's name
    • getLinkageType

      @NotNull public @NotNull RegionMember.LinkageType getLinkageType()
      Get the linkage type (region or sub-area).
      Returns:
      the linkage type
    • getRegionId

      public long getRegionId()
      Get the region ID. Defaults to -1 if linked to a sub-area.
      Returns:
      the region ID
    • setRegionId

      public void setRegionId(long regionId)
      Set the region ID.
      Parameters:
      regionId - the new region ID
    • getRegion

      @Nullable public @Nullable Region getRegion()
      Get the parent region from the cache.
      Returns:
      the region, or null if not found
    • getRegionName

      @NotNull public @NotNull String getRegionName()
      Get the parent region's name safely. Returns "?" if not found.
      Returns:
      the region name
    • getSubAreaId

      public long getSubAreaId()
      Get the sub-area ID. Defaults to -1 if linked to a region.
      Returns:
      the sub-area ID
    • setSubAreaId

      public void setSubAreaId(long subAreaId)
      Set the sub-area ID.
      Parameters:
      subAreaId - the new sub-area ID
    • getSubArea

      @Nullable public @Nullable SubArea getSubArea()
      Get the sub-area from the cache.
      Returns:
      the sub-area, or null if not found
    • getSubAreaName

      @NotNull public @NotNull String getSubAreaName()
      Get the sub-area's name safely. Returns "?" if not found.
      Returns:
      the sub-area name
    • getPlayerFlags

      public long getPlayerFlags()
      Get the player flags bitmask.
      Returns:
      the player flags
    • setPlayerFlags

      public void setPlayerFlags(long playerFlags)
      Set the player flags bitmask.
      Parameters:
      playerFlags - the new flags
    • getControlFlags

      public long getControlFlags()
      Get the control flags bitmask.
      Returns:
      the control flags
    • setControlFlags

      public void setControlFlags(long controlFlags)
      Set the control flags bitmask.
      Parameters:
      controlFlags - the new flags
    • getJoinedAt

      public long getJoinedAt()
      Get the join timestamp.
      Returns:
      the epoch-millis timestamp
    • setJoinedAt

      public void setJoinedAt(long joinedAt)
      Set the join timestamp.
      Parameters:
      joinedAt - the new timestamp
    • getTaxesAt

      public long getTaxesAt()
      Get the tax tracking timestamp.
      Returns:
      the epoch-millis timestamp
    • setTaxesAt

      public void setTaxesAt(long taxesAt)
      Set the tax tracking timestamp.
      Parameters:
      taxesAt - the new timestamp