Package xyz.geik.farmer.model.inventory
Class FarmerInv
java.lang.Object
xyz.geik.farmer.model.inventory.FarmerInv
Farmer inventory which contains items.
Farmer inventory is a list of items which farmer can take.
- Author:
- Geik
-
Field Summary
-
Constructor Summary
ConstructorDescriptionFarmer inv which don't have any item in it.FarmerInv
(List<FarmerItem> items, long capacity) Farmer inv which contains items set. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkMaterial
(org.bukkit.inventory.ItemStack itemStack) Checks if item is in default items.void
forceSumItem
(xyz.geik.glib.shades.xseries.XMaterial material, long amount) Forces adding item amount to stock.static @NotNull FarmerItem
getDefaultItem
(xyz.geik.glib.shades.xseries.XMaterial material) Gets item from default items.getStockedItem
(xyz.geik.glib.shades.xseries.XMaterial material) Gets item from farmer inv.long
negateItemAmount
(xyz.geik.glib.shades.xseries.XMaterial material, long amount) Removing x amount of item from stock.void
setItemAmount
(xyz.geik.glib.shades.xseries.XMaterial material, long amount) Update item amount in stock.long
sumItemAmount
(xyz.geik.glib.shades.xseries.XMaterial material, long amount) Adding item amount to stock.long
sumItemAmount
(xyz.geik.glib.shades.xseries.XMaterial material, @NotNull org.bukkit.entity.Item collectedItem) Adding item amount to stock.
-
Field Details
-
defaultItems
default items which farmer can take
-
-
Constructor Details
-
FarmerInv
Farmer inv which contains items set.- Parameters:
items
- item list of inventorycapacity
- capacity of inventory item can hold
-
FarmerInv
public FarmerInv()Farmer inv which don't have any item in it. Creating with default item set.
-
-
Method Details
-
getStockedItem
Gets item from farmer inv.- Parameters:
material
- of stock item- Returns:
- FarmerItem
-
getDefaultItem
@NotNull public static @NotNull FarmerItem getDefaultItem(xyz.geik.glib.shades.xseries.XMaterial material) Gets item from default items.- Parameters:
material
- of default item- Returns:
- FarmerItem
-
checkMaterial
public static boolean checkMaterial(org.bukkit.inventory.ItemStack itemStack) Checks if item is in default items.- Parameters:
itemStack
- to check- Returns:
- check status
-
sumItemAmount
public long sumItemAmount(xyz.geik.glib.shades.xseries.XMaterial material, @NotNull @NotNull org.bukkit.entity.Item collectedItem) Adding item amount to stock. Respects capacity and if it above capacity return additional amount.- Parameters:
material
- xmaterial of itemcollectedItem
- item of collected item- Returns:
- long left amount of item
-
sumItemAmount
public long sumItemAmount(xyz.geik.glib.shades.xseries.XMaterial material, long amount) Adding item amount to stock. Respects capacity and if it above capacity return additional amount.- Parameters:
material
- xmaterial of itemamount
- amount of the item- Returns:
- long left amount of item
-
forceSumItem
public void forceSumItem(xyz.geik.glib.shades.xseries.XMaterial material, long amount) Forces adding item amount to stock. Doesn't respect capacity.- Parameters:
material
- to sumamount
- to sum
-
negateItemAmount
public long negateItemAmount(xyz.geik.glib.shades.xseries.XMaterial material, long amount) Removing x amount of item from stock. Respects 0 if amount bigger than stock. And return the abs of negative number.- Parameters:
material
- xmaterial of itemamount
- amount of negate- Returns:
- long amount of abs
-
setItemAmount
public void setItemAmount(xyz.geik.glib.shades.xseries.XMaterial material, long amount) Update item amount in stock. Doesn't respect capacity.- Parameters:
material
- to set amountamount
- to set amount
-