Class Warning

java.lang.Object
tk.airshipcraft.commonlib.db.model.Warning

public class Warning extends Object

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 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

      public UUID getId()
      Returns the unique identifier for the warning.
      Returns:
      A UUID representing the warning's identity.
    • setId

      public void setId(UUID id)
      Sets the unique identifier for the warning.
      Parameters:
      id - The UUID to set.
    • getIssuer

      public UUID getIssuer()
      Returns the UUID of the issuer.
      Returns:
      A UUID representing the issuer's identity.
    • setIssuer

      public void setIssuer(UUID issuer)
      Sets the UUID of the issuer.
      Parameters:
      issuer - The UUID to set.
    • getMinecraftRecipient

      public UUID getMinecraftRecipient()
      Returns the UUID of the Minecraft player being warned.
      Returns:
      A UUID representing the player's identity.
    • setMinecraftRecipient

      public void setMinecraftRecipient(UUID minecraftRecipient)
      Sets the UUID of the Minecraft player being warned.
      Parameters:
      minecraftRecipient - The UUID to set.
    • getDiscordRecipient

      public String getDiscordRecipient()
      Returns the Discord ID of the user being warned.
      Returns:
      A String representing the user's Discord ID.
    • setDiscordRecipient

      public void setDiscordRecipient(String discordRecipient)
      Sets the Discord ID of the user being warned.
      Parameters:
      discordRecipient - The Discord ID to set.
    • getReason

      public String getReason()
      Returns the reason for issuing the warning.
      Returns:
      A String representing the reason for the warning.
    • setReason

      public void setReason(String reason)
      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

      public String toString()
      Returns a String representation of the warning.
      Overrides:
      toString in class Object
      Returns:
      A String representing the warning.
    • equals

      public boolean equals(Object obj)
      Compares this Warning to another Warning.
      Overrides:
      equals in class Object
      Parameters:
      obj - The Warning to compare to.
      Returns:
      True if the two Warnings are equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code for the Warning.
      Overrides:
      hashCode in class Object
      Returns:
      A hash code for the Warning.