Class GUIRow

java.lang.Object
me.block2block.hubparkour.api.gui.GUIRow

public class GUIRow extends Object
The GUIRow class represents a row in a GUI, where each row is identified by a unique row number and can contain a specified number of GUIItems. It enforces row and column constraints to ensure proper initialization and manipulation within a GUI grid structure.
  • Constructor Details

    • GUIRow

      public GUIRow(int rowNo)
      Constructs a new instance of GUIRow with a specified row number. Ensures that the row number provided is within a valid range.
      Parameters:
      rowNo - The row number to initialize. Must be between 0 and 5 inclusive.
      Throws:
      InvalidRowException - If the provided row number is not within the range 0-5.
  • Method Details

    • setItem

      public void setItem(int i, GUIItem item)
      Sets a GUIItem at the specified column index within the row.
      Parameters:
      i - The column index where the GUIItem should be placed. Must be between 0 and 8 inclusive.
      item - The GUIItem to be placed in the specified column.
      Throws:
      InvalidColumnException - If the specified column index is not within the range 0-8.
    • getRowNo

      public int getRowNo()
      Retrieves the row number associated with this instance of GUIRow.
      Returns:
      The row number, which is a value between 0 and 5 inclusive, representing the position of the row within the grid structure.
    • getRow

      public Map<Integer,GUIItem> getRow()
      Retrieves a copy of the row map, representing the mapping of column indices to GUIItem objects within this row. The returned map ensures the original data remains unmodifiable from outside the instance.
      Returns:
      A new map containing the column indices as keys and their respective GUIItem objects as values. The map may be empty if no items have been added to the row.
    • getItem

      public GUIItem getItem(int column)
      Retrieves the GUIItem located at the specified column index within this row.
      Parameters:
      column - The column index to retrieve the GUIItem from. Typically expected to be between 0 and 8 inclusive.
      Returns:
      The GUIItem at the specified column, or null if no item exists at the given index.