diff --git a/src/main/java/net/minestom/server/data/type/InventoryData.java b/src/main/java/net/minestom/server/data/type/InventoryData.java index cb3a95c70..c301f4b8f 100644 --- a/src/main/java/net/minestom/server/data/type/InventoryData.java +++ b/src/main/java/net/minestom/server/data/type/InventoryData.java @@ -12,7 +12,7 @@ public class InventoryData extends DataType { @Override public void encode(@NotNull BinaryWriter writer, @NotNull Inventory value) { final InventoryType inventoryType = value.getInventoryType(); - final int size = inventoryType.getAdditionalSlot(); + final int size = inventoryType.getSize(); // Inventory title & type writer.writeSizedString(value.getTitle()); @@ -29,7 +29,7 @@ public class InventoryData extends DataType { public Inventory decode(@NotNull BinaryReader reader) { final String title = reader.readSizedString(Integer.MAX_VALUE); final InventoryType inventoryType = InventoryType.valueOf(reader.readSizedString(Integer.MAX_VALUE)); - final int size = inventoryType.getAdditionalSlot(); + final int size = inventoryType.getSize(); Inventory inventory = new Inventory(inventoryType, title); diff --git a/src/main/java/net/minestom/server/inventory/Inventory.java b/src/main/java/net/minestom/server/inventory/Inventory.java index e9132a426..5c6985743 100644 --- a/src/main/java/net/minestom/server/inventory/Inventory.java +++ b/src/main/java/net/minestom/server/inventory/Inventory.java @@ -74,7 +74,7 @@ public class Inventory implements InventoryModifier, InventoryClickHandler, View this.inventoryType = inventoryType; this.title = title; - this.size = inventoryType.getAdditionalSlot(); + this.size = inventoryType.getSize(); this.offset = size; diff --git a/src/main/java/net/minestom/server/inventory/InventoryType.java b/src/main/java/net/minestom/server/inventory/InventoryType.java index bd829c502..e10c51c96 100644 --- a/src/main/java/net/minestom/server/inventory/InventoryType.java +++ b/src/main/java/net/minestom/server/inventory/InventoryType.java @@ -30,18 +30,26 @@ public enum InventoryType { CARTOGRAPHY(3), STONE_CUTTER(2); - private final int slot; + private final int size; - InventoryType(int slot) { - this.slot = slot; + InventoryType(int size) { + this.size = size; } public int getWindowType() { return ordinal(); } + public int getSize() { + return size; + } + + /** + * @deprecated use {@link #getSize()} + */ + @Deprecated public int getAdditionalSlot() { - return slot; + return size; } }