Package com.enhancedechest.gui
Class ChestListMenu
java.lang.Object
com.enhancedechest.gui.ChestListMenu
Builds the simple
/eclist inventory menu — the alternative to ChestDialogs' Dialog-API
list, chosen with enderchest.chest-list-menu: inventory. It is a bare chooser: one icon per owned
chest showing its name / slot count / expiry, and clicking an icon opens that chest directly. None of
the dialog's management actions (rename / set-main / icon / sort) exist here.
Layout. Chest icons sit in an inner rectangle of INNER_COLUMNS columns, framed by a
one-cell border of empty padding cells on every side (top/bottom rows, left/right columns) purely
for spacing. The menu grows a row at a time as the player owns more chests, so the icons stay centred
with even margins:
- up to 7 chests → 27 slots (3 rows, 1 inner row);
- up to 14 → 36 slots (4 rows, 2 inner rows);
- up to 21 → 45 slots (5 rows, 3 inner rows);
- up to 28 → 54 slots (6 rows, 4 inner rows) — the largest a chest inventory can be.
PAGE_SIZE chests gets paged 54-slot menus instead: the same 4 × 7
icon area per page, with previous / next arrows and a page indicator in the bottom border row. Page
turns re-render from the ordered snapshot kept on ChestListHolder rather than re-querying
storage; that is safe because clicking an icon still goes through ChestOpener.openChest, which
re-validates the chest against storage.
Chest text reuses the gui.yml dialog keys (title, slot count, expiry, main tag); only the page
controls have keys of their own (dialog.list-prev-page / list-next-page /
list-page / list-total).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intChests per page: the 54-slot menu's 4 inner rows × 7 columns = 28. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.Inventorybuild(Locale locale, List<ChestSummary> chests, UUID owner, @Nullable org.bukkit.Location sourceBlock) First page of the menu for an unordered chest list; seebuildPage(java.util.Locale, java.util.List<com.enhancedechest.model.ChestSummary>, java.util.UUID, org.bukkit.Location, int).org.bukkit.inventory.InventorybuildPage(Locale locale, List<ChestSummary> ordered, UUID owner, @Nullable org.bukkit.Location sourceBlock, int page) Builds one page of the menu forowner's chests.static List<ChestSummary> order(List<ChestSummary> chests) Display order: temp (expiring) chests first — same order as the dialog list — then natural index order.
-
Field Details
-
PAGE_SIZE
public static final int PAGE_SIZEChests per page: the 54-slot menu's 4 inner rows × 7 columns = 28. Up to this many chests fit one page, laid out exactly as before pagination existed (sized to the count, no controls).- See Also:
-
-
Constructor Details
-
ChestListMenu
-
-
Method Details
-
order
Display order: temp (expiring) chests first — same order as the dialog list — then natural index order. The holder keeps this ordered snapshot so page turns re-render without re-sorting. -
build
public org.bukkit.inventory.Inventory build(Locale locale, List<ChestSummary> chests, UUID owner, @Nullable @Nullable org.bukkit.Location sourceBlock) First page of the menu for an unordered chest list; seebuildPage(java.util.Locale, java.util.List<com.enhancedechest.model.ChestSummary>, java.util.UUID, org.bukkit.Location, int). -
buildPage
public org.bukkit.inventory.Inventory buildPage(Locale locale, List<ChestSummary> ordered, UUID owner, @Nullable @Nullable org.bukkit.Location sourceBlock, int page) Builds one page of the menu forowner's chests. A single page (≤PAGE_SIZEchests) is sized to the chest count and has no controls; more chests than that switch to fixed 54-slot pages with previous / next arrows (each shown only when that page exists) and a page indicator in the bottom border row.pageis clamped so an out-of-range request still lands on a real page.- Parameters:
ordered- chests already in display order (order(java.util.List<com.enhancedechest.model.ChestSummary>))sourceBlock- ender chest block the menu was opened from (for the lid animation on open), or nullpage- 0-based page to show
-