Class MailMessage
java.lang.Object
net.essentialsx.api.v2.services.mail.MailMessage
An immutable representation of a message sent as mail.
-
Constructor Summary
ConstructorDescriptionMailMessage
(boolean read, boolean legacy, String sender, UUID uuid, long timestamp, long expire, String message) -
Method Summary
Modifier and TypeMethodDescriptionGets the message content for normal mail or the entire mail format for legacy mail.Gets the sender's username at the time of sending the message.Gets the sender'sUUID
or null if the sender does not have a UUID.long
Gets the millisecond epoch at which this message will expire and no longer been shown to the user.long
Gets the millisecond epoch time when the message was sent.boolean
Helper method to check if this mail has expired and should not been shown to the recipient.boolean
isLegacy()
Checks if this message was created via legacy api or converted from legacy format.boolean
isRead()
Checks if this message has been read by its recipient yet.
-
Constructor Details
-
MailMessage
-
-
Method Details
-
isRead
public boolean isRead()Checks if this message has been read by its recipient yet.- Returns:
- true if this message has been read.
-
isLegacy
public boolean isLegacy()Checks if this message was created via legacy api or converted from legacy format. A legacy messages only contains data for the read state and message.- Returns:
- true if this message is a legacy message.
- See Also:
-
getSenderUsername
Gets the sender's username at the time of sending the message.- Returns:
- The sender's username.
-
getSenderUUID
Gets the sender'sUUID
or null if the sender does not have a UUID.- Returns:
- The sender's
UUID
or null.
-
getTimeSent
public long getTimeSent()Gets the millisecond epoch time when the message was sent.- Returns:
- The epoch time when message was sent.
-
getTimeExpire
public long getTimeExpire()Gets the millisecond epoch at which this message will expire and no longer been shown to the user.- Returns:
- The epoch time when the message will expire.
-
getMessage
Gets the message content for normal mail or the entire mail format for legacy mail.- Returns:
- The mail content or format.
- See Also:
-
isExpired
public boolean isExpired()Helper method to check if this mail has expired and should not been shown to the recipient.- Returns:
- true if this mail has expired.
-