mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2025-12-28 02:59:13 +00:00
Automatically expand menus to accommodate custom inventory/echest sizes, close #45
This commit is contained in:
@@ -568,7 +568,7 @@ public class BukkitPlayer extends OnlineUser {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Optional<ItemData>> showMenu(@NotNull ItemData itemData, boolean editable,
|
||||
int rows, @NotNull MineDown title) {
|
||||
int minimumRows, @NotNull MineDown title) {
|
||||
final CompletableFuture<Optional<ItemData>> updatedData = new CompletableFuture<>();
|
||||
|
||||
// Deserialize the item data to be shown and show it in a triumph GUI
|
||||
@@ -576,7 +576,10 @@ public class BukkitPlayer extends OnlineUser {
|
||||
try {
|
||||
// Build the GUI and populate with items
|
||||
final int itemCount = items.length;
|
||||
final StorageBuilder guiBuilder = Gui.storage().title(title.toComponent()).rows(rows).disableAllInteractions();
|
||||
final StorageBuilder guiBuilder = Gui.storage()
|
||||
.title(title.toComponent())
|
||||
.rows(Math.max(minimumRows, (int) Math.ceil(itemCount / 9.0)))
|
||||
.disableAllInteractions();
|
||||
final StorageGui gui = editable ? guiBuilder.enableAllInteractions().create() : guiBuilder.create();
|
||||
for (int i = 0; i < itemCount; i++) {
|
||||
if (items[i] != null) {
|
||||
|
||||
Reference in New Issue
Block a user