Skip to content

Add built-in filler item support to Menu #14

@Touchie771

Description

@Touchie771

Feature Request

The Menu builder should have built-in support for filling empty slots with a specified material, eliminating the need for external utility classes.

Problem

Currently, to fill empty slots with filler items, developers must:

  1. Create a separate utility class (like MenuUtils)
  2. Manually calculate which slots are occupied
  3. Create filler SlotItems for all empty slots
  4. Merge them with the actual items

This adds complexity and boilerplate that the library aims to reduce.

Proposed Solution

Add methods to Menu.Builder for automatic filler handling:

  • .fillEmptyWith(Material material) - Fill all empty slots
  • .fillEmptyWith(Material material, Component name) - Fill with custom name
  • .fillExcept(int... slots) - Fill all except specified slots
  • .fillRange(int start, int end, Material material) - Fill a range of slots

Example Usage

return Menu.newBuilder()
    .size(MENU_SIZE)
    .title(MENU_TITLE)
    .items(items) // Only the actual menu items
    .fillEmptyWith(Material.GRAY_STAINED_GLASS_PANE)
    .build();

Benefits

  • Eliminates need for MenuUtils helper class
  • Reduces boilerplate code
  • Makes the library more self-contained
  • Improves developer experience

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions