Class FarmerInv

java.lang.Object
xyz.geik.farmer.model.inventory.FarmerInv

public class FarmerInv extends Object
Farmer inventory which contains items. Farmer inventory is a list of items which farmer can take.
Author:
Geik
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    default items which farmer can take
  • Constructor Summary

    Constructors
    Constructor
    Description
    Farmer 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 Type
    Method
    Description
    static 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • defaultItems

      public static List<FarmerItem> defaultItems
      default items which farmer can take
  • Constructor Details

    • FarmerInv

      public FarmerInv(List<FarmerItem> items, long capacity)
      Farmer inv which contains items set.
      Parameters:
      items - item list of inventory
      capacity - 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

      public FarmerItem getStockedItem(xyz.geik.glib.shades.xseries.XMaterial material)
      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 item
      collectedItem - 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 item
      amount - 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 sum
      amount - 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 item
      amount - 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 amount
      amount - to set amount