Class RegionLog
java.lang.Object
me.tayebyassine.homestead.models.RegionLog
Represents a log entry for a region.
Log entries track author, message, timestamp, and read status. Messages are capped at 256 characters.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a log entry from pre-existing data (deserialization).Create a new log entry with a generated snowflake ID.Create a log entry with a generated snowflake ID. -
Method Summary
Modifier and TypeMethodDescription@NotNull StringGet the author name.@NotNull StringGet the log message.@Nullable RegionGet the parent region from the cache.longGet the region ID.@NotNull StringGet the parent region's name safely.longGet the send timestamp.longGet the unique snowflake ID.booleanisRead()Whether this entry has been read.voidSet the author name.voidsetMessage(@NotNull String message) Set the log message.voidsetRead(boolean read) Set whether this entry has been read.voidsetRegionId(long regionId) Set the region ID.voidsetSentAt(long sentAt) Set the send timestamp.
-
Constructor Details
-
RegionLog
-
RegionLog
-
RegionLog
Create a log entry from pre-existing data (deserialization).- Parameters:
id- the snowflake IDregionId- the region IDauthor- the author namemessage- the log messagesentAt- the send timestampread- 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
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
-
getAuthor
-
setAuthor
Set the author name.- Parameters:
author- the new author
-
getMessage
-
setMessage
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:
trueif read
-
setRead
public void setRead(boolean read) Set whether this entry has been read.- Parameters:
read-trueto mark as read
-