Class InventoryView

  • All Implemented Interfaces:
    ItemView

    public class InventoryView
    extends AbstractItemView
    Provides a view of all items in the current player's inventory.

    If no player object is known an empty inventory view is generated.

    • Constructor Detail

      • InventoryView

        public InventoryView​(@NotNull
                             @NotNull ItemSet itemSet,
                             @NotNull
                             @NotNull java.util.Comparator<CfItem> comparator)
        Creates a new instance.
        Parameters:
        itemSet - the item set to monitor
        comparator - the comparator for sorting
    • Method Detail

      • getSize

        public int getSize()
        Description copied from interface: ItemView
        Returns the number of items.
        Returns:
        the number of items
      • getItem

        @Nullable
        public @Nullable CfItem getItem​(int index)
        Description copied from interface: ItemView
        Returns the CfItem in a given slot.
        Parameters:
        index - the slot index
        Returns:
        the item or null if the slot is empty
      • setFilter

        public void setFilter​(@NotNull
                              @NotNull InventoryFilter filter)
        Sets the InventoryFilter.
        Parameters:
        filter - the new inventory filter