Interface Stackable<T>

Type Parameters:
T -
All Known Implementing Classes:
BalloonScroll, BlankPetScroll, ConsumableItem, Drink, EmptyScroll, Food, InvitationScroll, MarkedScroll, Money, NoStatsStackableItem, RainbowBeansScroll, Scroll, Seed, StackableItem, StatusHealer, SummonPetScroll, SummonScroll, TeleportScroll, TimedInvisibility, TimedStackableItem, TimedTeleportScroll, TwilightElixir, TwilightMossScroll

public interface Stackable<T>
this interface tags all items which are stackable.
Author:
mtotz
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    add​(T other)
    Adds the quantity of the other Stackable to this.
    int
    gets the maximum amount
    int
    gets the current quantity
    boolean
    isStackable​(T other)
    checks if the other object can be stacked onto this one
    void
    setCapacity​(int capacity)
    sets the maximum amount
    void
    setQuantity​(int amount)
    sets the quantity.
  • Method Details

    • getQuantity

      int getQuantity()
      gets the current quantity
      Returns:
      the quantity
    • setQuantity

      void setQuantity(int amount)
      sets the quantity.
      Parameters:
      amount - to be set
    • getCapacity

      int getCapacity()
      gets the maximum amount
      Returns:
      the maximum amount
    • setCapacity

      void setCapacity(int capacity)
      sets the maximum amount
      Parameters:
      capacity -
    • add

      int add(T other)
      Adds the quantity of the other Stackable to this.
      Parameters:
      other - other object to merge in
      Returns:
      the previous quantity
    • isStackable

      boolean isStackable(T other)
      checks if the other object can be stacked onto this one
      Parameters:
      other - other object
      Returns:
      true when both stackables are of the same type and can be merged