Package net.minestom.server.item.enchant
Record Class ConditionalEffect<E extends Enchantment.Effect>
java.lang.Object
java.lang.Record
net.minestom.server.item.enchant.ConditionalEffect<E>
- All Implemented Interfaces:
Enchantment.Effect
public record ConditionalEffect<E extends Enchantment.Effect>(E extends Enchantment.Effect effect, @Nullable DataPredicate requirements)
extends Record
implements Enchantment.Effect
-
Constructor Summary
ConstructorsConstructorDescriptionConditionalEffect(E effect, @Nullable DataPredicate requirements) Creates an instance of aConditionalEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptioneffect()Returns the value of theeffectrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static <E extends Enchantment.Effect>
@NotNull BinaryTagSerializer<ConditionalEffect<E>> nbtType(@NotNull BinaryTagSerializer<E> effectType) @Nullable DataPredicateReturns the value of therequirementsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ConditionalEffect
Creates an instance of aConditionalEffectrecord class.- Parameters:
effect- the value for theeffectrecord componentrequirements- the value for therequirementsrecord component
-
-
Method Details
-
nbtType
@NotNull public static <E extends Enchantment.Effect> @NotNull BinaryTagSerializer<ConditionalEffect<E>> nbtType(@NotNull @NotNull BinaryTagSerializer<E> effectType) -
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. All components in this record class are compared withObjects::equals(Object,Object). -
effect
Returns the value of theeffectrecord component.- Returns:
- the value of the
effectrecord component
-
requirements
Returns the value of therequirementsrecord component.- Returns:
- the value of the
requirementsrecord component
-