Class RegionInvite
java.lang.Object
me.tayebyassine.homestead.models.RegionInvite
Represents an invitation to join a region.
Invites track the region, the invited player, and the timestamp when the invite was issued.
-
Constructor Summary
ConstructorsConstructorDescriptionRegionInvite(long id, long regionId, UUID playerId, long invitedAt) Create an invitation from pre-existing data (deserialization).RegionInvite(long regionId, UUID playerId, long invitedAt) Create an invite with a generated snowflake ID.RegionInvite(long regionId, org.bukkit.OfflinePlayer player) Create an invite from a Bukkit player. -
Method Summary
Modifier and TypeMethodDescriptionlongGet the invite timestamp.@Nullable org.bukkit.OfflinePlayerGet the invited player as an offline player.@NotNull UUIDGet the invited player's UUID.@NotNull StringGet the invited player's name safely.@Nullable RegionGet the parent region from the cache.longGet the region ID.@NotNull StringGet the parent region's name safely.longGet the unique snowflake ID.voidsetInvitedAt(long invitedAt) Set the invite timestamp.voidsetPlayer(@NotNull org.bukkit.OfflinePlayer player) Set the invited player.voidsetPlayerId(@NotNull UUID playerId) Set the invited player's UUID.voidsetRegionId(long regionId) Set the region ID.
-
Constructor Details
-
RegionInvite
public RegionInvite(long regionId, org.bukkit.OfflinePlayer player) Create an invite from a Bukkit player.- Parameters:
regionId- the region IDplayer- the invited player
-
RegionInvite
Create an invite with a generated snowflake ID.- Parameters:
regionId- the region IDplayerId- the invited player UUIDinvitedAt- the invite timestamp
-
RegionInvite
Create an invitation from pre-existing data (deserialization).- Parameters:
id- the snowflake IDregionId- the region IDplayerId- the invited player UUIDinvitedAt- 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
Get the parent region from the cache.- Returns:
- the region, or
nullif not found
-
getRegionName
Get the parent region's name safely. Returns"?"if not found.- Returns:
- the region name
-
getPlayerId
-
setPlayerId
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
nullif not found
-
setPlayer
public void setPlayer(@NotNull @NotNull org.bukkit.OfflinePlayer player) Set the invited player.- Parameters:
player- the new player
-
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
-