Record Class EnchantOfferGenerator.GeneratedOffer

java.lang.Object
java.lang.Record
io.artificial.enchantments.internal.enchanttable.EnchantOfferGenerator.GeneratedOffer
Record Components:
definition - the enchantment definition
level - the generated level
cost - the cost in experience levels
configuration - the table configuration used
Enclosing class:
EnchantOfferGenerator

public static record EnchantOfferGenerator.GeneratedOffer(@NotNull EnchantmentDefinition definition, int level, int cost, @NotNull EnchantTableConfiguration configuration) extends Record
Record representing a generated enchantment offer.

Contains the enchantment definition, calculated level, cost, and configuration used for this offer.

Since:
0.2.0
  • Constructor Details

    • GeneratedOffer

      public GeneratedOffer(@NotNull @NotNull EnchantmentDefinition definition, int level, int cost, @NotNull @NotNull EnchantTableConfiguration configuration)
      Creates an instance of a GeneratedOffer record class.
      Parameters:
      definition - the value for the definition record component
      level - the value for the level record component
      cost - the value for the cost record component
      configuration - the value for the configuration record component
  • Method Details

    • toBukkitOffer

      @NotNull public org.bukkit.enchantments.EnchantmentOffer toBukkitOffer(@NotNull @NotNull org.bukkit.enchantments.Enchantment enchantment)
      Converts this generated offer to a Bukkit EnchantmentOffer.
      Parameters:
      enchantment - the native Bukkit enchantment
      Returns:
      the Bukkit enchantment offer
      Since:
      0.2.0
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • definition

      @NotNull public @NotNull EnchantmentDefinition definition()
      Returns the value of the definition record component.
      Returns:
      the value of the definition record component
    • level

      public int level()
      Returns the value of the level record component.
      Returns:
      the value of the level record component
    • cost

      public int cost()
      Returns the value of the cost record component.
      Returns:
      the value of the cost record component
    • configuration

      @NotNull public @NotNull EnchantTableConfiguration configuration()
      Returns the value of the configuration record component.
      Returns:
      the value of the configuration record component