Class RegionLog

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

public final class RegionLog extends Object
Represents a log entry for a region.

Log entries track author, message, timestamp, and read status. Messages are capped at 256 characters.

  • Constructor Details

    • RegionLog

      public RegionLog(long regionId, String author, String message)
      Create a new log entry with a generated snowflake ID.
      Parameters:
      regionId - the region ID
      author - the author name
      message - the log message (truncated to 256 chars)
    • RegionLog

      public RegionLog(long regionId, String author, String message, long sentAt, boolean read)
      Create a log entry with a generated snowflake ID.
      Parameters:
      regionId - the region ID
      author - the author name
      message - the log message
      sentAt - the send timestamp
      read - whether the entry has been read
    • RegionLog

      public RegionLog(long id, long regionId, String author, String message, long sentAt, boolean read)
      Create a log entry from pre-existing data (deserialization).
      Parameters:
      id - the snowflake ID
      regionId - the region ID
      author - the author name
      message - the log message
      sentAt - the send timestamp
      read - whether the entry has been read
  • Method Details

    • getUniqueId

      public long getUniqueId()
      Get the unique snowflake ID.
      Returns:
      the log 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
    • getAuthor

      @NotNull public @NotNull String getAuthor()
      Get the author name.
      Returns:
      the author
    • setAuthor

      public void setAuthor(@NotNull @NotNull String author)
      Set the author name.
      Parameters:
      author - the new author
    • getMessage

      @NotNull public @NotNull String getMessage()
      Get the log message.
      Returns:
      the message
    • setMessage

      public void setMessage(@NotNull @NotNull String message)
      Set the log message. Truncated to 256 characters.
      Parameters:
      message - the new message
    • getSentAt

      public long getSentAt()
      Get the send timestamp.
      Returns:
      the epoch-millis timestamp
    • setSentAt

      public void setSentAt(long sentAt)
      Set the send timestamp.
      Parameters:
      sentAt - the new timestamp
    • isRead

      public boolean isRead()
      Whether this entry has been read.
      Returns:
      true if read
    • setRead

      public void setRead(boolean read)
      Set whether this entry has been read.
      Parameters:
      read - true to mark as read