Package com.kamikazejam.kamicommon.menu
Class AbstractMenu<M extends AbstractMenu<M>>
java.lang.Object
com.kamikazejam.kamicommon.menu.api.MenuHolder
com.kamikazejam.kamicommon.menu.AbstractMenu<M>
- All Implemented Interfaces:
UpdatingMenu,Menu<M>,InventoryHolder
- Direct Known Subclasses:
OneClickMenu,PaginatedMenu,SimpleMenu
public abstract sealed class AbstractMenu<M extends AbstractMenu<M>>
extends MenuHolder
implements Menu<M>, UpdatingMenu
permits SimpleMenu, PaginatedMenu, OneClickMenu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MenuEvents<M> protected final @NotNull PrioritizedMenuIconMap<M> protected final MenuOptions<M> protected final PlayerFields inherited from class com.kamikazejam.kamicommon.menu.api.MenuHolder
inventory, size, title -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMenu(@NotNull AbstractMenuBuilder<M, ?> builder, @NotNull Player player) -
Method Summary
Modifier and TypeMethodDescriptionbooleanclose()Close theInventoryfor thePlayerthat this menu was created for.
Identical to callingHumanEntity.closeInventory().@NotNull IMenuIconsAccess<M> modifyIcons(@NotNull Consumer<IMenuIconsAccess<M>> consumer) @Nullable InventoryViewopen()@Nullable InventoryViewopen(boolean resetTickCounter) protected voidvoidplaceIcons(@Nullable Predicate<MenuIcon<M>> needsUpdate) Manually trigger an update for all icons matching this predicate.
If the predicate is passed, the icon will be re-built and set in the inventory.
If the predicate is null, it will always update all icons.voidAttempt to reopen the menu for the given player.voidreopenMenu(boolean resetTickCounter) Attempt to reopen the menu for the given player.voidresizeMenu(@NotNull MenuSize size) voidvoidMethods inherited from class com.kamikazejam.kamicommon.menu.api.MenuHolder
clear, closeAll, deleteInventory, equals, firstEmpty, firstEmpty, firstEmpty, getHolder, getInventory, getItem, getMenuSize, getRawInventory, getSize, getViewers, hashCode, replaceTitle, setItem, setItemMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.kamikazejam.kamicommon.menu.Menu
buildClickData, buildPlayerClickData, getEvents, getMenuSize, getOptionsMethods inherited from interface com.kamikazejam.kamicommon.menu.api.icons.interfaces.UpdatingMenu
getInventory
-
Field Details
-
player
-
events
-
options
-
-
Constructor Details
-
Method Details
-
reopenMenu
public void reopenMenu()Description copied from interface:MenuAttempt to reopen the menu for the given player. Depending on the menu type, this may not be possible for all possible
By default, this method will NOT reset the tick counter.
SeeMenu.reopenMenu(boolean)for reopening with reset.- Specified by:
reopenMenuin interfaceMenu<M extends AbstractMenu<M>>
-
reopenMenu
public void reopenMenu(boolean resetTickCounter) Description copied from interface:MenuAttempt to reopen the menu for the given player. Depending on the menu type, this may not be possible for all possible- Specified by:
reopenMenuin interfaceMenu<M extends AbstractMenu<M>>- Parameters:
resetTickCounter- If true, the tick counter will be reset to 0. This is useful for menus that are not paginated, and
-
open
- Returns:
- The
InventoryViewfor the new menu, or null if the player was not online to open the menu for.
-
open
- Parameters:
resetTickCounter- If true, the tick counter will be reset to 0 when opening the menu.- Returns:
- The
InventoryViewfor the new menu, or null if the player was not online to open the menu for.
-
close
public boolean close()Close theInventoryfor thePlayerthat this menu was created for.
Identical to callingHumanEntity.closeInventory().- Returns:
- If the inventory was successfully closed. False if the player is no longer valid (not online).
-
modifyIcons
-
getMenuIcons
- Specified by:
getMenuIconsin interfaceMenu<M extends AbstractMenu<M>>
-
getMenuIconsAccess
- Specified by:
getMenuIconsAccessin interfaceMenu<M extends AbstractMenu<M>>
-
getFillerIcon
- Specified by:
getFillerIconin interfaceMenu<M extends AbstractMenu<M>>
-
updateOneTick
@Internal public void updateOneTick()- Specified by:
updateOneTickin interfaceUpdatingMenu
-
placeIcons
Manually trigger an update for all icons matching this predicate.
If the predicate is passed, the icon will be re-built and set in the inventory.
If the predicate is null, it will always update all icons.- Parameters:
needsUpdate- An optional predicate to filter which icons need new builders.
-
placeFiller
-