Record Class Cause

java.lang.Object
java.lang.Record
dev.yowsef.stealablock.api.cause.Cause

public record Cause(@NotNull CauseType type, @Nullable String pluginName, @Nullable String detail) extends Record
Describes who and what triggered a state change in StealABlock.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Cause
     
    static final Cause
     
    static final Cause
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Cause(@NotNull CauseType type, @Nullable String pluginName, @Nullable String detail)
    Creates an instance of a Cause record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable String
    Returns the value of the detail record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    static @NotNull Cause
    of(@NotNull CauseType type)
     
    static @NotNull Cause
    of(@NotNull CauseType type, @Nullable String detail)
     
    static @NotNull Cause
    plugin(@NotNull org.bukkit.plugin.Plugin plugin)
     
    static @NotNull Cause
    plugin(@NotNull org.bukkit.plugin.Plugin plugin, @Nullable String detail)
     
    @Nullable String
    Returns the value of the pluginName record component.
    @NotNull String
    Returns a string representation of this record class.
    @NotNull CauseType
    Returns the value of the type record component.

    Methods inherited from class Object

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

    • GAMEPLAY

      public static final Cause GAMEPLAY
    • ADMIN

      public static final Cause ADMIN
    • VAULT

      public static final Cause VAULT
  • Constructor Details

    • Cause

      public Cause(@NotNull @NotNull CauseType type, @Nullable @Nullable String pluginName, @Nullable @Nullable String detail)
      Creates an instance of a Cause record class.
      Parameters:
      type - the value for the type record component
      pluginName - the value for the pluginName record component
      detail - the value for the detail record component
  • Method Details

    • of

      @NotNull public static @NotNull Cause of(@NotNull @NotNull CauseType type)
    • of

      @NotNull public static @NotNull Cause of(@NotNull @NotNull CauseType type, @Nullable @Nullable String detail)
    • plugin

      @NotNull public static @NotNull Cause plugin(@NotNull @NotNull org.bukkit.plugin.Plugin plugin)
    • plugin

      @NotNull public static @NotNull Cause plugin(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @Nullable @Nullable String detail)
    • toString

      @NotNull public @NotNull 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.
    • type

      @NotNull public @NotNull CauseType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • pluginName

      @Nullable public @Nullable String pluginName()
      Returns the value of the pluginName record component.
      Returns:
      the value of the pluginName record component
    • detail

      @Nullable public @Nullable String detail()
      Returns the value of the detail record component.
      Returns:
      the value of the detail record component