Class RegionInvite

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

public final class RegionInvite extends Object
Represents an invitation to join a region.

Invites track the region, the invited player, and the timestamp when the invite was issued.

  • Constructor Details

    • RegionInvite

      public RegionInvite(long regionId, org.bukkit.OfflinePlayer player)
      Create an invite from a Bukkit player.
      Parameters:
      regionId - the region ID
      player - the invited player
    • RegionInvite

      public RegionInvite(long regionId, UUID playerId, long invitedAt)
      Create an invite with a generated snowflake ID.
      Parameters:
      regionId - the region ID
      playerId - the invited player UUID
      invitedAt - the invite timestamp
    • RegionInvite

      public RegionInvite(long id, long regionId, UUID playerId, long invitedAt)
      Create an invitation from pre-existing data (deserialization).
      Parameters:
      id - the snowflake ID
      regionId - the region ID
      playerId - the invited player UUID
      invitedAt - the invite timestamp
  • Method Details

    • getUniqueId

      public long getUniqueId()
      Get the unique snowflake ID.
      Returns:
      the invite ID
    • getRegionId

      public long getRegionId()
      Get the region ID.
      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
    • getPlayerId

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

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

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

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

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

      public long getInvitedAt()
      Get the invite timestamp.
      Returns:
      the epoch-millis timestamp
    • setInvitedAt

      public void setInvitedAt(long invitedAt)
      Set the invite timestamp.
      Parameters:
      invitedAt - the new timestamp