Record Class HudObjectType<T extends HudObject>
java.lang.Object
java.lang.Record
kr.toxicity.hud.api.configuration.HudObjectType<T>
- Type Parameters:
T- object type- Record Components:
clazz- object's classname- object's namefunction- object's render function
public record HudObjectType<T extends HudObject>(@NotNull Class<T extends HudObject> clazz, @NotNull String name, @NotNull BiFunction<T extends HudObject,HudPlayer,HudComponentSupplier<T extends HudObject>> function, @NotNull Function<String,T extends HudObject> stringGetter, @NotNull Supplier<Collection<T extends HudObject>> valuesSupplier)
extends Record
A type of HUD element
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HudObjectType<Compass> Compass typestatic final HudObjectType<Hud> Hud typestatic final HudObjectType<Popup> Popup type -
Constructor Summary
ConstructorsConstructorDescriptionHudObjectType(@NotNull Class<T> clazz, @NotNull String name, @NotNull BiFunction<T, HudPlayer, HudComponentSupplier<T>> function, @NotNull Function<String, T> stringGetter, @NotNull Supplier<Collection<T>> valuesSupplier) Creates an instance of aHudObjectTyperecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull @Unmodifiable Collection<T> all()clazz()Returns the value of theclazzrecord component.booleanIndicates whether some other object is "equal to" this one.@NotNull BiFunction<T, HudPlayer, HudComponentSupplier<T>> function()Returns the value of thefunctionrecord component.inthashCode()Returns a hash code value for this object.@NotNull HudComponentSupplier<?> Gets supplier from an object@NotNull Stringname()Returns the value of thenamerecord component.Returns the value of thestringGetterrecord component.final StringtoString()Returns a string representation of this record class.static @NotNull @Unmodifiable Collection<HudObjectType<?>> types()@NotNull Supplier<Collection<T>> Returns the value of thevaluesSupplierrecord component.
-
Field Details
-
HUD
Hud type- See Also:
-
POPUP
Popup type- See Also:
-
COMPASS
Compass type- See Also:
-
-
Constructor Details
-
HudObjectType
public HudObjectType(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull String name, @NotNull @NotNull BiFunction<T, HudPlayer, HudComponentSupplier<T>> function, @NotNull @NotNull Function<String, T> stringGetter, @NotNull @NotNull Supplier<Collection<T>> valuesSupplier) Creates an instance of aHudObjectTyperecord class.
-
-
Method Details
-
types
-
byName
-
all
-
defaultObjects
-
invoke
@Internal @NotNull public @NotNull HudComponentSupplier<?> invoke(@NotNull @NotNull HudObject object, @NotNull @NotNull HudPlayer player) Gets supplier from an object- Parameters:
object- target objectplayer- target player- Returns:
- supplier
-
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). -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. -
clazz
Returns the value of theclazzrecord component.- Returns:
- the value of the
clazzrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
function
Returns the value of thefunctionrecord component.- Returns:
- the value of the
functionrecord component
-
stringGetter
Returns the value of thestringGetterrecord component.- Returns:
- the value of the
stringGetterrecord component
-
valuesSupplier
Returns the value of thevaluesSupplierrecord component.- Returns:
- the value of the
valuesSupplierrecord component
-