Record Class CosmeticResult

java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.cosmetics.CosmeticResult
Record Components:
status - what happened
change - the player's cosmetics of the type before and after, when storage was reached; null otherwise
transaction - the payment of a purchase, when one was attempted; null otherwise
message - why it failed, for logs; null on success

public record CosmeticResult(@NotNull CosmeticResult.Status status, @Nullable CosmeticChange change, @Nullable CurrencyTransaction transaction, @Nullable String message) extends Record
What became of a player's own action on a cosmetic: equipping, unequipping or buying it.
Since:
1.11.0
  • Constructor Details

    • CosmeticResult

      public CosmeticResult(@NotNull @NotNull CosmeticResult.Status status, @Nullable @Nullable CosmeticChange change, @Nullable @Nullable CurrencyTransaction transaction, @Nullable @Nullable String message)
      Creates an instance of a CosmeticResult record class.
      Parameters:
      status - the value for the status record component
      change - the value for the change record component
      transaction - the value for the transaction record component
      message - the value for the message record component
  • Method Details

    • of

      @NotNull public static @NotNull CosmeticResult of(@NotNull @NotNull CosmeticResult.Status status, @Nullable @Nullable String message)
      A result that reached nothing.
    • isSuccess

      public boolean isSuccess()
      Whether it was done.
    • getChange

      @NotNull public @NotNull Optional<CosmeticChange> getChange()
      The change, when storage was reached.
    • getTransaction

      @NotNull public @NotNull Optional<CurrencyTransaction> getTransaction()
      The payment, when one was attempted.
    • 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.
    • status

      @NotNull public @NotNull CosmeticResult.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • change

      @Nullable public @Nullable CosmeticChange change()
      Returns the value of the change record component.
      Returns:
      the value of the change record component
    • transaction

      @Nullable public @Nullable CurrencyTransaction transaction()
      Returns the value of the transaction record component.
      Returns:
      the value of the transaction record component
    • message

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