Record Class DeathMessage

java.lang.Object
java.lang.Record
net.darkhax.deathknell.common.impl.message.DeathMessage
All Implemented Interfaces:
IDeathMessage

public record DeathMessage(String key) extends Record implements IDeathMessage
A simple death message provider.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of a DeathMessage record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.minecraft.network.chat.Component
    getMessage(Object... args)
    Generates the message to display for this death message.
    net.minecraft.network.chat.Component
    getSubMessage(String alt, Object... args)
    Generates a sub-variant of the death message.
    final int
    Returns a hash code value for this object.
    key()
    Returns the value of the key record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DeathMessage

      public DeathMessage(String key)
      Creates an instance of a DeathMessage record class.
      Parameters:
      key - the value for the key record component
  • Method Details

    • getMessage

      public net.minecraft.network.chat.Component getMessage(Object... args)
      Description copied from interface: IDeathMessage
      Generates the message to display for this death message.
      Specified by:
      getMessage in interface IDeathMessage
      Parameters:
      args - The message parameters such as victim name and killer name.
      Returns:
      The death message to display.
    • getSubMessage

      public net.minecraft.network.chat.Component getSubMessage(String alt, Object... args)
      Description copied from interface: IDeathMessage
      Generates a sub-variant of the death message.
      Specified by:
      getSubMessage in interface IDeathMessage
      Parameters:
      alt - The variant suffix to generate.
      args - The message parameters such as victim name and killer name.
      Returns:
      The death message to display.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • key

      public String key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component