Class MenuSizeRows
java.lang.Object
com.kamikazejam.kamicommon.menu.api.struct.size.MenuSizeRows
- All Implemented Interfaces:
MenuSize
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull MenuSize
copy()
Deep copies thisMenuSize
into an identical object clone.@NotNull Inventory
createInventory
(@NotNull InventoryHolder holder, @NotNull String title) Creates a newInventory
with the givenInventoryHolder
and title.
Uses thisMenuSize
to determine the size of the inventory.int
int
getSlotInLastRow
(int index) Returns the slot number for the slot in the last row with the given index in that row.int
mapPositionToSlot
(int row, int col) Maps a position to a slot number.static int
mapPositionToSlot
(int row, int col, int rows)
-
Constructor Details
-
MenuSizeRows
public MenuSizeRows(int rows)
-
-
Method Details
-
createInventory
@NotNull public @NotNull Inventory createInventory(@NotNull @NotNull InventoryHolder holder, @NotNull @NotNull String title) Description copied from interface:MenuSize
Creates a newInventory
with the givenInventoryHolder
and title.
Uses thisMenuSize
to determine the size of the inventory.- Specified by:
createInventory
in interfaceMenuSize
-
getSlotInLastRow
public int getSlotInLastRow(int index) Description copied from interface:MenuSize
Returns the slot number for the slot in the last row with the given index in that row.- Specified by:
getSlotInLastRow
in interfaceMenuSize
-
copy
Description copied from interface:MenuSize
Deep copies thisMenuSize
into an identical object clone. -
getNumberOfSlots
public int getNumberOfSlots()- Specified by:
getNumberOfSlots
in interfaceMenuSize
- Returns:
- the 1-index number of slots in this menu size.
-
mapPositionToSlot
Description copied from interface:MenuSize
Maps a position to a slot number. For example position (1, 1) maps to slot 0 (top-left) in a traditional inventory.- Specified by:
mapPositionToSlot
in interfaceMenuSize
- Parameters:
row
- The row (top to bottom) of the position. (1-indexed)col
- The column (left to right) of the position. (1-indexed)- Returns:
- The bukkit slot number corresponding to the given position.
- Throws:
IllegalStateException
- if this method is called on an unsupported MenuSize (including someMenuSizeType
s using non-standardInventoryType
configurations.)
-
mapPositionToSlot
- Throws:
IllegalArgumentException
-