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 TypeMethodDescriptionint
Adds the quantity of the other Stackable to this.int
gets the maximum amountint
gets the current quantityboolean
isStackable(T other)
checks if the other object can be stacked onto this onevoid
setCapacity(int capacity)
sets the maximum amountvoid
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
Adds the quantity of the other Stackable to this.- Parameters:
other
- other object to merge in- Returns:
- the previous quantity
-
isStackable
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
-