Record Class PlayerKill

java.lang.Object
java.lang.Record
com.djrapitops.plan.gathering.domain.PlayerKill
All Implemented Interfaces:
DateHolder

public record PlayerKill(PlayerKill.Killer killer, PlayerKill.Victim victim, String weapon, long date, ServerIdentifier server) extends Record implements DateHolder
Represents a player vs player kill.
  • Constructor Details

    • PlayerKill

      public PlayerKill(PlayerKill.Killer killer, PlayerKill.Victim victim, ServerIdentifier server, String weapon, long date)
    • PlayerKill

      public PlayerKill(PlayerKill.Killer killer, PlayerKill.Victim victim, String weapon, long date, ServerIdentifier server)
      Creates an instance of a PlayerKill record class.
      Parameters:
      killer - the value for the killer record component
      victim - the value for the victim record component
      weapon - the value for the weapon record component
      date - the value for the date record component
      server - the value for the server record component
  • Method Details

    • weapon

      public String weapon()
      Get the Weapon used as string.
      Returns:
      For example DIAMOND_SWORD
    • toString

      public 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
    • isSelfKill

      public boolean isSelfKill()
    • isNotSelfKill

      public boolean isNotSelfKill()
    • toJson

      public String toJson()
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • killer

      public PlayerKill.Killer killer()
      Returns the value of the killer record component.
      Returns:
      the value of the killer record component
    • victim

      public PlayerKill.Victim victim()
      Returns the value of the victim record component.
      Returns:
      the value of the victim record component
    • date

      public long date()
      Returns the value of the date record component.
      Specified by:
      date in interface DateHolder
      Returns:
      the value of the date record component
    • server

      public ServerIdentifier server()
      Returns the value of the server record component.
      Returns:
      the value of the server record component