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 onInventoryClickEventthat 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 onInventoryClickEventthat 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 toPlayerandInventoryCloseEvent.@NotNull MenuEvents<M> addCloseCallback(@NotNull String id, @NotNull MenuCloseCallback callback) Add a callback that runs when the inventory is closed, with access toPlayerandInventoryCloseEvent.@NotNull MenuEvents<M> addDragCallback(@NotNull MenuDragCallback callback) Add a callback that runs when a drag event affects menu slots (and is not cancelled).@NotNull MenuEvents<M> addDragCallback(@NotNull String id, @NotNull MenuDragCallback callback) Add a callback that runs when a drag event affects menu slots (and is not cancelled).@NotNull MenuEvents<M> addDragPredicate(@NotNull String id, @NotNull Predicate<InventoryDragEvent> predicate) Add a predicate onInventoryDragEventthat must pass for drag operations on menu slots to proceed.
This applies to theMenu's inventory only.
For adding a predicate for player inventory drags, useaddPlayerDragPredicate(String, Predicate)@NotNull MenuEvents<M> addDragPredicate(@NotNull Predicate<InventoryDragEvent> predicate) Add a predicate onInventoryDragEventthat must pass for drag operations on menu slots to proceed.
This applies to theMenu's inventory only.
For adding a predicate for player inventory drags, useaddPlayerDragPredicate(Predicate)@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 onInventoryClickEventthat 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 onInventoryClickEventthat 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)@NotNull MenuEvents<M> addPlayerDragPredicate(@NotNull String id, @NotNull Predicate<InventoryDragEvent> predicate) Add a predicate onInventoryDragEventthat must pass for drag operations in the player's inventory.
This only applies when the drag does NOT affect any menu slots.
For adding a predicate for menu inventory drags, useaddDragPredicate(String, Predicate)@NotNull MenuEvents<M> addPlayerDragPredicate(@NotNull Predicate<InventoryDragEvent> predicate) Add a predicate onInventoryDragEventthat must pass for drag operations in the player's inventory.
This only applies when the drag does NOT affect any menu slots.
For adding a predicate for menu inventory drags, useaddDragPredicate(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()booleanremoveClickPredicate(@NotNull String id) Remove a click predicate by IDbooleanremoveCloseCallback(@NotNull String id) Remove a close callback by IDbooleanremoveDragCallback(@NotNull String id) Remove a drag callback by IDbooleanremoveDragPredicate(@NotNull String id) Remove a drag predicate by IDbooleanremoveOpenCallback(@NotNull String id) Remove an open callback by IDbooleanremovePlayerClickPredicate(@NotNull String id) Remove a player inventory click predicate by IDbooleanremovePlayerDragPredicate(@NotNull String id) Remove a player inventory drag predicate by IDbooleanremovePlayerInvClick(@NotNull String id) Remove a player inventory click by IDbooleanremovePlayerSlotClick(@NotNull String id) Remove a player inventory click by IDbooleanremovePostCloseCallback(@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 onInventoryClickEventthat 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
MenuEventsobject for chaining
-
addClickPredicate
@NotNull public @NotNull MenuEvents<M> addClickPredicate(@NotNull @NotNull String id, @NotNull @NotNull Predicate<InventoryClickEvent> predicate) Add a predicate onInventoryClickEventthat 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
MenuEventsobject 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 onInventoryClickEventthat 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
MenuEventsobject for chaining
-
addPlayerClickPredicate
@NotNull public @NotNull MenuEvents<M> addPlayerClickPredicate(@NotNull @NotNull String id, @NotNull @NotNull Predicate<InventoryClickEvent> predicate) Add a predicate onInventoryClickEventthat 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
MenuEventsobject for chaining
-
removePlayerClickPredicate
Remove a player inventory click predicate by ID -
addDragPredicate
@NotNull public @NotNull MenuEvents<M> addDragPredicate(@NotNull @NotNull Predicate<InventoryDragEvent> predicate) Add a predicate onInventoryDragEventthat must pass for drag operations on menu slots to proceed.
This applies to theMenu's inventory only.
For adding a predicate for player inventory drags, useaddPlayerDragPredicate(Predicate)- Returns:
- this
MenuEventsobject for chaining
-
addDragPredicate
@NotNull public @NotNull MenuEvents<M> addDragPredicate(@NotNull @NotNull String id, @NotNull @NotNull Predicate<InventoryDragEvent> predicate) Add a predicate onInventoryDragEventthat must pass for drag operations on menu slots to proceed.
This applies to theMenu's inventory only.
For adding a predicate for player inventory drags, useaddPlayerDragPredicate(String, Predicate)- Parameters:
id- The ID to associate with this predicate for later removal- Returns:
- this
MenuEventsobject for chaining
-
removeDragPredicate
Remove a drag predicate by ID -
addPlayerDragPredicate
@NotNull public @NotNull MenuEvents<M> addPlayerDragPredicate(@NotNull @NotNull Predicate<InventoryDragEvent> predicate) Add a predicate onInventoryDragEventthat must pass for drag operations in the player's inventory.
This only applies when the drag does NOT affect any menu slots.
For adding a predicate for menu inventory drags, useaddDragPredicate(Predicate)- Returns:
- this
MenuEventsobject for chaining
-
addPlayerDragPredicate
@NotNull public @NotNull MenuEvents<M> addPlayerDragPredicate(@NotNull @NotNull String id, @NotNull @NotNull Predicate<InventoryDragEvent> predicate) Add a predicate onInventoryDragEventthat must pass for drag operations in the player's inventory.
This only applies when the drag does NOT affect any menu slots.
For adding a predicate for menu inventory drags, useaddDragPredicate(String, Predicate)- Parameters:
id- The ID to associate with this predicate for later removal- Returns:
- this
MenuEventsobject for chaining
-
removePlayerDragPredicate
Remove a player inventory drag predicate by ID -
removeDragCallback
Remove a drag callback by ID -
copy
-
addPlayerInvClick(PlayerSlotClick)instead.