Class PredicateButton
java.lang.Object
me.hsgamer.hscore.minecraft.gui.button.PredicateButton
- All Implemented Interfaces:
Function<@NotNull InventoryContext,,@Nullable ActionItem> GUIElement
public class PredicateButton
extends Object
implements GUIElement, Function<@NotNull InventoryContext,@Nullable ActionItem>
The button with predicates
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable ActionItemapply(@NotNull InventoryContext context) Function<@NotNull InventoryContext, @Nullable ActionItem> Get the buttonFunction<@NotNull InventoryContext, @Nullable ActionItem> Get the fallback buttonvoidinit()Initialize the element.voidsetButton(@NotNull Function<@NotNull InventoryContext, @Nullable ActionItem> button) Set the buttonvoidsetClickFuturePredicate(@NotNull Function<@NotNull ClickEvent, @NotNull CompletableFuture<@NotNull Boolean>> clickFuturePredicate) Set the click future predicatevoidsetClickPredicate(@NotNull Predicate<@NotNull ClickEvent> clickPredicate) Set the click predicatevoidsetFallbackButton(@NotNull Function<@NotNull InventoryContext, @Nullable ActionItem> fallbackButton) Set the fallback buttonvoidsetPreventSpamClick(boolean preventSpamClick) Set whether to prevent spam click when checking click predicatevoidsetViewPredicate(@NotNull Predicate<@NotNull UUID> viewPredicate) Set the view predicatevoidstop()Stop the element.
-
Constructor Details
-
PredicateButton
public PredicateButton()
-
-
Method Details
-
setViewPredicate
Set the view predicate- Parameters:
viewPredicate- the view predicate
-
setClickPredicate
Set the click predicate- Parameters:
clickPredicate- the click predicate
-
setClickFuturePredicate
public void setClickFuturePredicate(@NotNull @NotNull Function<@NotNull ClickEvent, @NotNull CompletableFuture<@NotNull Boolean>> clickFuturePredicate) Set the click future predicate- Parameters:
clickFuturePredicate- the click future predicate
-
setPreventSpamClick
public void setPreventSpamClick(boolean preventSpamClick) Set whether to prevent spam click when checking click predicate- Parameters:
preventSpamClick- true if it should
-
getButton
Get the button- Returns:
- the button
-
setButton
public void setButton(@NotNull @NotNull Function<@NotNull InventoryContext, @Nullable ActionItem> button) Set the button- Parameters:
button- the button
-
getFallbackButton
Get the fallback button- Returns:
- the fallback button
-
setFallbackButton
public void setFallbackButton(@NotNull @NotNull Function<@NotNull InventoryContext, @Nullable ActionItem> fallbackButton) Set the fallback button- Parameters:
fallbackButton- the fallback button
-
apply
- Specified by:
applyin interfaceFunction<@NotNull InventoryContext,@Nullable ActionItem>
-
init
public void init()Description copied from interface:GUIElementInitialize the element. Should be called before adding to the GUI.- Specified by:
initin interfaceGUIElement
-
stop
public void stop()Description copied from interface:GUIElementStop the element. Should be called after removing from the GUI.- Specified by:
stopin interfaceGUIElement
-