From f7bfc270faf1e3666f0e5b5b31a8fe889f1aebd4 Mon Sep 17 00:00:00 2001 From: APickledWalrus Date: Sun, 16 Aug 2020 16:29:36 -0400 Subject: [PATCH] Fix #4 --- .../github/apickledwalrus/skriptgui/util/InventoryUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/apickledwalrus/skriptgui/util/InventoryUtils.java b/src/main/java/io/github/apickledwalrus/skriptgui/util/InventoryUtils.java index c7cc013..dfd7d87 100644 --- a/src/main/java/io/github/apickledwalrus/skriptgui/util/InventoryUtils.java +++ b/src/main/java/io/github/apickledwalrus/skriptgui/util/InventoryUtils.java @@ -5,6 +5,7 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.ItemStack; +import org.eclipse.jdt.annotation.Nullable; public class InventoryUtils { @@ -71,9 +72,9 @@ public static int getInvertedSlotTo(Inventory invTo, ItemStack item) { * @param name The name for the {@link Inventory} * @return The created {@link Inventory} */ - public static Inventory newInventory(InventoryType type, Integer size, String name) { + public static Inventory newInventory(InventoryType type, @Nullable Integer size, @Nullable String name) { - size = size == null ? type.getDefaultSize() : size * 9; + size = (size == null || size == 0) ? type.getDefaultSize() : size * 9; if (name == null) { name = type.getDefaultTitle();