Class RegionBan
java.lang.Object
me.tayebyassine.homestead.models.RegionBan
Represents a ban issued against a player for a specific region.
Bans are capped at 256 characters for the reason string. The ban record persists until explicitly removed by the region owner.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a ban from pre-existing data (deserialization).Create a ban with a generated snowflake ID.Create a ban from a Bukkit player. -
Method Summary
Modifier and TypeMethodDescriptionlongGet the ban timestamp.@Nullable org.bukkit.OfflinePlayerGet the banned player as an offline player.@NotNull UUIDGet the banned player's UUID.@NotNull StringGet the banned player's name safely.@Nullable StringGet the ban reason.@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.voidsetBannedAt(long bannedAt) Set the ban timestamp.voidsetPlayer(@NotNull org.bukkit.OfflinePlayer player) Set the banned player.voidsetPlayerId(@NotNull UUID playerId) Set the banned player's UUID.voidSet the ban reason.voidsetRegionId(long regionId) Set the region ID.
-
Constructor Details
-
RegionBan
Create a ban from a Bukkit player.- Parameters:
regionId- the region IDplayer- the player to banreason- the ban reason
-
RegionBan
-
RegionBan
-
-
Method Details
-
getUniqueId
public long getUniqueId()Get the unique snowflake ID.- Returns:
- the ban 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 banned player's UUID.- Parameters:
playerId- the new player UUID
-
getPlayer
@Nullable public @Nullable org.bukkit.OfflinePlayer getPlayer()Get the banned player as an offline player.- Returns:
- the player, or
nullif not found
-
setPlayer
public void setPlayer(@NotNull @NotNull org.bukkit.OfflinePlayer player) Set the banned player.- Parameters:
player- the new player
-
getPlayerName
Get the banned player's name safely. Returns"?"if not found.- Returns:
- the player's name
-
getReason
Get the ban reason.- Returns:
- the reason, or
nullif not provided
-
setReason
Set the ban reason. Truncated to 256 characters.- Parameters:
reason- the new reason, ornullto clear
-
getBannedAt
public long getBannedAt()Get the ban timestamp.- Returns:
- the epoch-millis timestamp
-
setBannedAt
public void setBannedAt(long bannedAt) Set the ban timestamp.- Parameters:
bannedAt- the new timestamp
-