Record Class EnchantOfferGenerator.GeneratedOffer
java.lang.Object
java.lang.Record
io.artificial.enchantments.internal.enchanttable.EnchantOfferGenerator.GeneratedOffer
- Record Components:
definition- the enchantment definitionlevel- the generated levelcost- the cost in experience levelsconfiguration- 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 Summary
ConstructorsConstructorDescriptionGeneratedOffer(@NotNull EnchantmentDefinition definition, int level, int cost, @NotNull EnchantTableConfiguration configuration) Creates an instance of aGeneratedOfferrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull EnchantTableConfigurationReturns the value of theconfigurationrecord component.intcost()Returns the value of thecostrecord component.@NotNull EnchantmentDefinitionReturns the value of thedefinitionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intlevel()Returns the value of thelevelrecord component.org.bukkit.enchantments.EnchantmentOffertoBukkitOffer(@NotNull org.bukkit.enchantments.Enchantment enchantment) Converts this generated offer to a Bukkit EnchantmentOffer.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
GeneratedOffer
public GeneratedOffer(@NotNull @NotNull EnchantmentDefinition definition, int level, int cost, @NotNull @NotNull EnchantTableConfiguration configuration) Creates an instance of aGeneratedOfferrecord class.- Parameters:
definition- the value for thedefinitionrecord componentlevel- the value for thelevelrecord componentcost- the value for thecostrecord componentconfiguration- the value for theconfigurationrecord 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
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
definition
Returns the value of thedefinitionrecord component.- Returns:
- the value of the
definitionrecord component
-
level
public int level()Returns the value of thelevelrecord component.- Returns:
- the value of the
levelrecord component
-
cost
public int cost()Returns the value of thecostrecord component.- Returns:
- the value of the
costrecord component
-
configuration
Returns the value of theconfigurationrecord component.- Returns:
- the value of the
configurationrecord component
-