Record Class EnumProperty<E extends Enum<E>>

java.lang.Object
java.lang.Record
org.geysermc.geyser.entity.properties.type.EnumProperty<E>
All Implemented Interfaces:
org.geysermc.geyser.api.entity.property.GeyserEntityProperty<E>, org.geysermc.geyser.api.entity.property.type.GeyserEnumEntityProperty<E>, AbstractEnumProperty<E>, PropertyType<E,org.cloudburstmc.protocol.bedrock.data.entity.IntEntityProperty>

public record EnumProperty<E extends Enum<E>>(org.geysermc.geyser.api.util.Identifier identifier, Class<E extends Enum<E>> enumClass, @NonNull E extends Enum<E> defaultValue) extends Record implements AbstractEnumProperty<E>, org.geysermc.geyser.api.entity.property.type.GeyserEnumEntityProperty<E>
  • Constructor Details

    • EnumProperty

      public EnumProperty(org.geysermc.geyser.api.util.Identifier identifier, Class<E> enumClass, @NonNull E defaultValue)
      Creates an instance of a EnumProperty record class.
      Parameters:
      identifier - the value for the identifier record component
      enumClass - the value for the enumClass record component
      defaultValue - the value for the defaultValue record component
  • Method Details

    • values

      public List<E> values()
    • allBedrockValues

      public List<String> allBedrockValues()
      Specified by:
      allBedrockValues in interface AbstractEnumProperty<E extends Enum<E>>
    • indexOf

      public int indexOf(E value)
      Specified by:
      indexOf in interface AbstractEnumProperty<E extends Enum<E>>
    • defaultIndex

      public int defaultIndex()
      Specified by:
      defaultIndex in interface AbstractEnumProperty<E extends Enum<E>>
    • 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.
    • identifier

      public org.geysermc.geyser.api.util.Identifier identifier()
      Returns the value of the identifier record component.
      Specified by:
      identifier in interface org.geysermc.geyser.api.entity.property.GeyserEntityProperty<E extends Enum<E>>
      Returns:
      the value of the identifier record component
    • enumClass

      public Class<E> enumClass()
      Returns the value of the enumClass record component.
      Returns:
      the value of the enumClass record component
    • defaultValue

      public @NonNull E defaultValue()
      Returns the value of the defaultValue record component.
      Specified by:
      defaultValue in interface org.geysermc.geyser.api.entity.property.GeyserEntityProperty<E extends Enum<E>>
      Returns:
      the value of the defaultValue record component