From 7a79ad0084840180b6138d2c6c2f6647da778fb7 Mon Sep 17 00:00:00 2001 From: Natan Date: Fri, 14 Aug 2026 14:58:09 -0300 Subject: [PATCH 1/3] fix: missing `maxSize()` implementation --- .../inventoryframework/ViewConfigBuilder.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfigBuilder.java b/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfigBuilder.java index 94175577..95d3d388 100644 --- a/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfigBuilder.java +++ b/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfigBuilder.java @@ -98,9 +98,14 @@ public ViewConfigBuilder size(int size) { return this; } - // TODO needs documentation - public ViewConfigBuilder maxSize() { - throw new UnsupportedOperationException("TODO"); + /** + * Expands the size of the inventory to the max permitted by {@link #getType() its type}. + * + * @return This configuration builder. + * @see ViewType#getMaxSize() + */ + public ViewConfigBuilder maxSize() { + return size(Integer.MAX_VALUE); } /** @@ -278,9 +283,11 @@ public ViewConfig build() { option, option.defaultValue())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + final int size = getSize() == Integer.MAX_VALUE ? getType().getMaxSize() : getSize(); + return new ViewConfig( getTitle(), - getSize(), + size, getType(), optionsMap, getLayout(), From 346947083e51ff89dd7b45d80292609788ff1208 Mon Sep 17 00:00:00 2001 From: Natan Date: Fri, 14 Aug 2026 14:58:57 -0300 Subject: [PATCH 2/3] chore: remove comments --- .../main/java/me/devnatan/inventoryframework/ViewConfig.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfig.java b/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfig.java index 2fed7881..6d010e68 100644 --- a/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfig.java +++ b/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfig.java @@ -118,7 +118,6 @@ public boolean isOptionSet(@NotNull Option option) { return false; } - // TODO docs @SuppressWarnings("unused") @VisibleForTesting public boolean isOptionSet(@NotNull Option option, T value) { @@ -145,7 +144,6 @@ public static Option createOption(@NotNull String name, @NotNull T defaul public ViewConfig merge(ViewConfig other) { if (other == null) return this; - // TODO merge "options" and "modifiers" from both, distinctly return new ViewConfig( merge(other, ViewConfig::getTitle, Objects::nonNull), merge(other, ViewConfig::getSize, value -> value != 0), @@ -169,7 +167,6 @@ private T merge(ViewConfig other, Function retriever, Functio return value; } - // TODO docs @SuppressWarnings("unused") @FunctionalInterface public interface Modifier { From 7627e41c731636933d56322924482481fb6950f4 Mon Sep 17 00:00:00 2001 From: Natan Date: Fri, 14 Aug 2026 14:59:32 -0300 Subject: [PATCH 3/3] refactor: lint codebase --- .../runtime/view/RowColumnSample.java | 20 +++++++++---------- .../inventoryframework/ViewConfigBuilder.java | 18 ++++++++--------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/examples/paper/src/main/java/me/devnatan/inventoryframework/runtime/view/RowColumnSample.java b/examples/paper/src/main/java/me/devnatan/inventoryframework/runtime/view/RowColumnSample.java index 5701c8db..35978438 100644 --- a/examples/paper/src/main/java/me/devnatan/inventoryframework/runtime/view/RowColumnSample.java +++ b/examples/paper/src/main/java/me/devnatan/inventoryframework/runtime/view/RowColumnSample.java @@ -4,14 +4,13 @@ import me.devnatan.inventoryframework.ViewConfigBuilder; import me.devnatan.inventoryframework.context.RenderContext; import me.devnatan.inventoryframework.state.MutableIntState; -import me.devnatan.inventoryframework.state.MutableState; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; public class RowColumnSample extends View { - private final MutableIntState intState = mutableState(0); + private final MutableIntState intState = mutableState(0); @Override public void onInit(@NotNull ViewConfigBuilder config) { @@ -20,16 +19,15 @@ public void onInit(@NotNull ViewConfigBuilder config) { @Override public void onFirstRender(@NotNull RenderContext render) { - render.slot(13) - .withItem(intState.get(render) == 3 ? new ItemStack(Material.GOLD_INGOT) : new ItemStack(Material.IRON_INGOT)); + render.slot(13) + .withItem( + intState.get(render) == 3 + ? new ItemStack(Material.GOLD_INGOT) + : new ItemStack(Material.IRON_INGOT)); - render.firstRow((pos, slot) -> - slot.withItem(new ItemStack(Material.BLUE_STAINED_GLASS_PANE)) - .onClick(click -> intState.increment(click)) - ); + render.firstRow((pos, slot) -> slot.withItem(new ItemStack(Material.BLUE_STAINED_GLASS_PANE)) + .onClick(click -> intState.increment(click))); - render.lastColumn((pos, slot) -> - slot.withItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE)) - ); + render.lastColumn((pos, slot) -> slot.withItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE))); } } diff --git a/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfigBuilder.java b/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfigBuilder.java index 95d3d388..addca176 100644 --- a/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfigBuilder.java +++ b/inventory-framework-api/src/main/java/me/devnatan/inventoryframework/ViewConfigBuilder.java @@ -98,13 +98,13 @@ public ViewConfigBuilder size(int size) { return this; } - /** - * Expands the size of the inventory to the max permitted by {@link #getType() its type}. - * - * @return This configuration builder. - * @see ViewType#getMaxSize() - */ - public ViewConfigBuilder maxSize() { + /** + * Expands the size of the inventory to the max permitted by {@link #getType() its type}. + * + * @return This configuration builder. + * @see ViewType#getMaxSize() + */ + public ViewConfigBuilder maxSize() { return size(Integer.MAX_VALUE); } @@ -283,11 +283,11 @@ public ViewConfig build() { option, option.defaultValue())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - final int size = getSize() == Integer.MAX_VALUE ? getType().getMaxSize() : getSize(); + final int size = getSize() == Integer.MAX_VALUE ? getType().getMaxSize() : getSize(); return new ViewConfig( getTitle(), - size, + size, getType(), optionsMap, getLayout(),