Package space.maxus.flare.react
Class Reactive
java.lang.Object
space.maxus.flare.react.Reactive
A utility class for reactivity within Flare.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <V> @NotNull ReactiveItemProvider<V>item(@NotNull ReactiveState<V> state, @NotNull org.apache.commons.lang3.concurrent.Computable<@Nullable V, @Nullable org.bukkit.inventory.ItemStack> provider) Creates a reactive item provider from a state and a provider.static <V> @NotNull ReactiveComponent<V>text(@NotNull ReactiveState<V> state, @NotNull org.apache.commons.lang3.concurrent.Computable<@Nullable V, net.kyori.adventure.text.Component> producer) Creates a reactive component from a state and a producer.
-
Method Details
-
text
@NotNull public static <V> @NotNull ReactiveComponent<V> text(@NotNull @NotNull ReactiveState<V> state, @NotNull @NotNull org.apache.commons.lang3.concurrent.Computable<@Nullable V, net.kyori.adventure.text.Component> producer) Creates a reactive component from a state and a producer.- Type Parameters:
V- The type of the reactive state- Parameters:
state- The reactive state to hook toproducer- The producer to use to produce the reactive component- Returns:
- The reactive component
-
item
@NotNull public static <V> @NotNull ReactiveItemProvider<V> item(@NotNull @NotNull ReactiveState<V> state, @NotNull @NotNull org.apache.commons.lang3.concurrent.Computable<@Nullable V, @Nullable org.bukkit.inventory.ItemStack> provider) Creates a reactive item provider from a state and a provider. This is (partially) a wrapper aroundItemProvider.reactive(Computable)- Type Parameters:
V- The type of the reactive state- Parameters:
state- The reactive state to hook toprovider- The provider to use to produce the item reactively- Returns:
- The reactive item provider
-