Class MenuEvents<M extends Menu<M>>
java.lang.Object
com.kamikazejam.kamicommon.menu.api.struct.MenuEvents<M>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull MenuEvents
<M> addClickPredicate
(@NotNull String id, @NotNull Predicate<InventoryClickEvent> predicate) Add a predicate onInventoryClickEvent
that must pass for the click handlers on that slot to be executed.
This applies to theMenu
's inventory only, not the player's inventory.
For adding a predicate for player inventory clicks, useaddPlayerClickPredicate(String, Predicate)
@NotNull MenuEvents
<M> addClickPredicate
(@NotNull Predicate<InventoryClickEvent> predicate) Add a predicate onInventoryClickEvent
that must pass for the click handlers on that slot to be executed.
This applies to theMenu
's inventory only, not the player's inventory.
For adding a predicate for player inventory clicks, useaddPlayerClickPredicate(Predicate)
@NotNull MenuEvents
<M> addCloseCallback
(@NotNull MenuCloseCallback callback) Add a callback that runs when the inventory is closed, with access toPlayer
andInventoryCloseEvent
.@NotNull MenuEvents
<M> addCloseCallback
(@NotNull String id, @NotNull MenuCloseCallback callback) Add a callback that runs when the inventory is closed, with access toPlayer
andInventoryCloseEvent
.@NotNull MenuEvents
<M> addOpenCallback
(@Nullable MenuOpenCallback menuOpen) Add a callback that runs when the inventory is opened.@NotNull MenuEvents
<M> addOpenCallback
(@NotNull String id, @Nullable MenuOpenCallback menuOpen) Add a callback that runs when the inventory is opened.@NotNull MenuEvents
<M> addPlayerClickPredicate
(@NotNull String id, @NotNull Predicate<InventoryClickEvent> predicate) Add a predicate onInventoryClickEvent
that must pass for the click handlers on that slot to be executed.
This applies to thePlayer
's inventory only, not the menu's inventory.
For adding a predicate for the Menu inventory clicks, useaddClickPredicate(String, Predicate)
@NotNull MenuEvents
<M> addPlayerClickPredicate
(@NotNull Predicate<InventoryClickEvent> predicate) Add a predicate onInventoryClickEvent
that must pass for the click handlers on that slot to be executed.
This applies to thePlayer
's inventory only, not the menu's inventory.
For adding a predicate for the Menu inventory clicks, useaddClickPredicate(Predicate)
addPlayerInvClick
(@NotNull PlayerSlotClick<M> click) Listen to ALL player inventory clicks.addPlayerInvClick
(@NotNull String id, @NotNull PlayerSlotClick<M> click) Listen to ALL player inventory clicks.@NotNull MenuEvents
<M> addPlayerSlotClick
(int slot, @NotNull PlayerSlotClick<M> click) Listen to a player inventory click.@NotNull MenuEvents
<M> addPlayerSlotClick
(int slot, @NotNull String id, @NotNull PlayerSlotClick<M> click) Listen to a player inventory click.@NotNull MenuEvents
<M> addPlayerSlotClick
(@NotNull PlayerSlotClick<M> click) Deprecated.@NotNull MenuEvents
<M> addPostCloseCallback
(@NotNull MenuPostCloseCallback<M> callback) Add a callback that runs 1 tick after the inventory is closed, with access toPlayer
.
Note: This 1 tick delay is technically enough time for a player to log out.@NotNull MenuEvents
<M> addPostCloseCallback
(@NotNull String id, @NotNull MenuPostCloseCallback<M> callback) Add a callback that runs 1 tick after the inventory is closed, with access toPlayer
.
Note: This 1 tick delay is technically enough time for a player to log out.@NotNull MenuEvents
<M> copy()
boolean
removeClickPredicate
(@NotNull String id) Remove a click predicate by IDboolean
removeCloseCallback
(@NotNull String id) Remove a close callback by IDboolean
removeOpenCallback
(@NotNull String id) Remove an open callback by IDboolean
removePlayerClickPredicate
(@NotNull String id) Remove a player inventory click predicate by IDboolean
removePlayerInvClick
(@NotNull String id) Remove a player inventory click by IDboolean
removePlayerSlotClick
(@NotNull String id) Remove a player inventory click by IDboolean
removePostCloseCallback
(@NotNull String id) Remove a post-close callback by ID
-
Constructor Details
-
MenuEvents
public MenuEvents()
-
-
Method Details
-
addClickPredicate
@NotNull public @NotNull MenuEvents<M> addClickPredicate(@NotNull @NotNull Predicate<InventoryClickEvent> predicate) Add a predicate onInventoryClickEvent
that must pass for the click handlers on that slot to be executed.
This applies to theMenu
's inventory only, not the player's inventory.
For adding a predicate for player inventory clicks, useaddPlayerClickPredicate(Predicate)
- Returns:
- this
MenuEvents
object for chaining
-
addClickPredicate
@NotNull public @NotNull MenuEvents<M> addClickPredicate(@NotNull @NotNull String id, @NotNull @NotNull Predicate<InventoryClickEvent> predicate) Add a predicate onInventoryClickEvent
that must pass for the click handlers on that slot to be executed.
This applies to theMenu
's inventory only, not the player's inventory.
For adding a predicate for player inventory clicks, useaddPlayerClickPredicate(String, Predicate)
- Parameters:
id
- The ID to associate with this predicate for later removal- Returns:
- this
MenuEvents
object for chaining
-
removeClickPredicate
Remove a click predicate by ID -
removeCloseCallback
Remove a close callback by ID -
removePostCloseCallback
Remove a post-close callback by ID -
removeOpenCallback
Remove an open callback by ID -
removePlayerSlotClick
Remove a player inventory click by ID -
removePlayerInvClick
Remove a player inventory click by ID -
addPlayerClickPredicate
@NotNull public @NotNull MenuEvents<M> addPlayerClickPredicate(@NotNull @NotNull Predicate<InventoryClickEvent> predicate) Add a predicate onInventoryClickEvent
that must pass for the click handlers on that slot to be executed.
This applies to thePlayer
's inventory only, not the menu's inventory.
For adding a predicate for the Menu inventory clicks, useaddClickPredicate(Predicate)
- Returns:
- this
MenuEvents
object for chaining
-
addPlayerClickPredicate
@NotNull public @NotNull MenuEvents<M> addPlayerClickPredicate(@NotNull @NotNull String id, @NotNull @NotNull Predicate<InventoryClickEvent> predicate) Add a predicate onInventoryClickEvent
that must pass for the click handlers on that slot to be executed.
This applies to thePlayer
's inventory only, not the menu's inventory.
For adding a predicate for the Menu inventory clicks, useaddClickPredicate(String, Predicate)
- Parameters:
id
- The ID to associate with this predicate for later removal- Returns:
- this
MenuEvents
object for chaining
-
removePlayerClickPredicate
Remove a player inventory click predicate by ID -
copy
-
addPlayerInvClick(PlayerSlotClick)
instead.