Class RegionBan

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

public final class RegionBan extends Object
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 Details

    • RegionBan

      public RegionBan(long regionId, org.bukkit.OfflinePlayer player, String reason)
      Create a ban from a Bukkit player.
      Parameters:
      regionId - the region ID
      player - the player to ban
      reason - the ban reason
    • RegionBan

      public RegionBan(long regionId, UUID playerId, String reason, long bannedAt)
      Create a ban with a generated snowflake ID.
      Parameters:
      regionId - the region ID
      playerId - the player UUID
      reason - the ban reason (truncated to 256 chars)
      bannedAt - the ban timestamp
    • RegionBan

      public RegionBan(long id, long regionId, UUID playerId, String reason, long bannedAt)
      Create a ban from pre-existing data (deserialization).
      Parameters:
      id - the snowflake ID
      regionId - the region ID
      playerId - the player UUID
      reason - the ban reason
      bannedAt - the ban timestamp
  • 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

      @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 banned player's UUID.
      Returns:
      the player UUID
    • setPlayerId

      public void setPlayerId(@NotNull @NotNull UUID playerId)
      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 null if not found
    • setPlayer

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

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

      @Nullable public @Nullable String getReason()
      Get the ban reason.
      Returns:
      the reason, or null if not provided
    • setReason

      public void setReason(@Nullable @Nullable String reason)
      Set the ban reason. Truncated to 256 characters.
      Parameters:
      reason - the new reason, or null to 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