Class Warning
java.lang.Object
tk.airshipcraft.commonlib.db.model.Warning
Represents a warning issued to a player or user. This class is designed to handle warnings for both Minecraft players and Discord users. It stores the issuer's UUID, the recipient's Minecraft UUID (if applicable), the recipient's Discord ID (if applicable), the reason for the warning, and a timestamp indicating when the warning was issued.
Warnings are stored in a database table with the following schema:
CREATE TABLE IF NOT EXISTS warnings ( id UUID PRIMARY KEY, issuer UUID NOT NULL, minecraft_recipient UUID, discord_recipient VARCHAR(255), reason VARCHAR(255) NOT NULL, timestamp BIGINT NOT NULL );
- Since:
- 2024-01-06
- Version:
- 1.0.0
- Author:
- notzune
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this Warning to another Warning.Returns the Discord ID of the user being warned.getId()
Returns the unique identifier for the warning.Returns the UUID of the issuer.Returns the UUID of the Minecraft player being warned.Returns the reason for issuing the warning.long
Returns the timestamp when the warning was issued.int
hashCode()
Returns a hash code for the Warning.void
setDiscordRecipient
(String discordRecipient) Sets the Discord ID of the user being warned.void
Sets the unique identifier for the warning.void
Sets the UUID of the issuer.void
setMinecraftRecipient
(UUID minecraftRecipient) Sets the UUID of the Minecraft player being warned.void
Sets the reason for issuing the warning.void
setTimestamp
(long timestamp) Sets the timestamp when the warning was issued.toString()
Returns a String representation of the warning.
-
Constructor Details
-
Warning
public Warning(UUID id, UUID issuer, UUID minecraftRecipient, String discordRecipient, String reason, long timestamp) Constructs a new Warning instance.- Parameters:
id
- The unique identifier for the warning.issuer
- The UUID of the issuer.minecraftRecipient
- The UUID of the Minecraft player being warned. Can be null if the warning is for a Discord user.discordRecipient
- The Discord ID of the user being warned. Can be null if the warning is for a Minecraft player.reason
- The reason for issuing the warning.timestamp
- The timestamp when the warning was issued.
-
-
Method Details
-
getId
Returns the unique identifier for the warning.- Returns:
- A UUID representing the warning's identity.
-
setId
Sets the unique identifier for the warning.- Parameters:
id
- The UUID to set.
-
getIssuer
Returns the UUID of the issuer.- Returns:
- A UUID representing the issuer's identity.
-
setIssuer
Sets the UUID of the issuer.- Parameters:
issuer
- The UUID to set.
-
getMinecraftRecipient
Returns the UUID of the Minecraft player being warned.- Returns:
- A UUID representing the player's identity.
-
setMinecraftRecipient
Sets the UUID of the Minecraft player being warned.- Parameters:
minecraftRecipient
- The UUID to set.
-
getDiscordRecipient
Returns the Discord ID of the user being warned.- Returns:
- A String representing the user's Discord ID.
-
setDiscordRecipient
Sets the Discord ID of the user being warned.- Parameters:
discordRecipient
- The Discord ID to set.
-
getReason
Returns the reason for issuing the warning.- Returns:
- A String representing the reason for the warning.
-
setReason
Sets the reason for issuing the warning.- Parameters:
reason
- The reason to set.
-
getTimestamp
public long getTimestamp()Returns the timestamp when the warning was issued.- Returns:
- A long representing the timestamp.
-
setTimestamp
public void setTimestamp(long timestamp) Sets the timestamp when the warning was issued.- Parameters:
timestamp
- The timestamp to set.
-
toString
Returns a String representation of the warning. -
equals
Compares this Warning to another Warning. -
hashCode
public int hashCode()Returns a hash code for the Warning.
-