Class Product

java.lang.Object
us.teaminceptus.novaconomy.api.util.Product
All Implemented Interfaces:
Comparable<Product>, ConfigurationSerializable
Direct Known Subclasses:
BusinessProduct

public class Product extends Object implements ConfigurationSerializable, Comparable<Product>
Represents a Sellable Product
  • Constructor Details

  • Method Details

    • getItem

      @NotNull public @NotNull ItemStack getItem()
      Fetches the Product's Item.
      Returns:
      Product Item selling
    • setItem

      @NotNull public @NotNull Product setItem(@NotNull @NotNull ItemStack item) throws IllegalArgumentException
      Sets the Product's Selling Item.
      Parameters:
      item - Item to sell
      Returns:
      this Product, for chaining
      Throws:
      IllegalArgumentException - if item is null
    • getPrice

      @NotNull public @NotNull Price getPrice()
      Fetches the Product's Price.
      Returns:
      Price Product is selling at
    • getEconomy

      @Nullable public @Nullable Economy getEconomy()
      Fetches the Product's Economy.
      Returns:
      Economy Product is purchased with
    • getAmount

      @NotNull public @org.jetbrains.annotations.NotNull double getAmount()
      Fetches the Product's Price Amount.
      Returns:
      Price Amount Product is selling at
    • toEntry

      @NotNull public Map.Entry<ItemStack,Price> toEntry()
      Converts this Product to an immutable Map Entry.
      Returns:
      Immutable Map Entry
    • setPrice

      @NotNull public @NotNull Product setPrice(@NotNull @NotNull Price price) throws IllegalArgumentException
      Sets the Proudct's selling price.
      Parameters:
      price - Price Selling at
      Returns:
      this Product, for chaining
      Throws:
      IllegalArgumentException - if Price is null
    • serialize

      public Map<String,Object> serialize()
      Specified by:
      serialize in interface ConfigurationSerializable
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • deserialize

      @Nullable public static @Nullable Product deserialize(@Nullable @Nullable Map<String,Object> serial) throws IllegalArgumentException
      Deserializes a Product into a Map.
      Parameters:
      serial - Serialization from serialize()
      Returns:
      Deserialized Product, or null if serial is null
      Throws:
      IllegalArgumentException - if a part is missing or malformed
    • compareTo

      public int compareTo(@NotNull @NotNull Product p)
      Specified by:
      compareTo in interface Comparable<Product>