java.lang.Object
us.teaminceptus.novaconomy.api.economy.market.Receipt
All Implemented Interfaces:
Serializable, ConfigurationSerializable

public final class Receipt extends Object implements ConfigurationSerializable, Serializable
Utility class for keeping track of purchased items on the Market
Since:
1.7.1
See Also:
  • Constructor Details

    • Receipt

      public Receipt(@NotNull @NotNull Material purchased, double purchasePrice, int purchaseAmount, @NotNull @NotNull OfflinePlayer player)
      Constructs a new Market Receipt.
      Parameters:
      purchased - Material purchased
      purchasePrice - Price of the Material
      purchaseAmount - Amount of the Material purchased
      player - Player who purchased the Material
    • Receipt

      public Receipt(@NotNull @NotNull Material purchased, double purchasePrice, int purchaseAmount, @NotNull @NotNull OfflinePlayer player, @NotNull @NotNull Date timestamp)
      Constructs a new Market Receipt.
      Parameters:
      purchased - Material purchased
      purchasePrice - Price of the Material
      purchaseAmount - Amount of the Material purchased
      player - Player who purchased the Material
      timestamp - Timestamp of the purchase
  • Method Details

    • getPurchaser

      @NotNull public @NotNull OfflinePlayer getPurchaser()
      Fetches the player who purchased the Material.
      Returns:
      Player who purchased the Material
    • getPurchased

      @NotNull public @NotNull Material getPurchased()
      Fetches the Material purchased.
      Returns:
      Material purchased
    • getPurchaseSubtotal

      public double getPurchaseSubtotal()
      Fetches how much the Material was purchased for, without factoring in the amount.
      Returns:
      Price of the Material purchased
    • getPurchaseAmount

      public int getPurchaseAmount()
      Fetches the amount of the Material purchased.
      Returns:
      Amount of the Material purchased
    • getPurchasePrice

      public double getPurchasePrice()
      Fetches the total price of the purchase.
      Returns:
      Total Price of the purchase
    • getTimestamp

      @NotNull public @NotNull Date getTimestamp()
      Fetches the timestamp of the purchase.
      Returns:
      Timestamp of the purchase
    • isRecent

      public boolean isRecent()

      Checks if the purchase was recent.

      The definition of a "recent purchase" means that the purchase was made before the next restock event.

      Returns:
      true if the purchase was recent, false otherwise
    • serialize

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

      @NotNull public static @NotNull Receipt deserialize(@NotNull @NotNull Map<String,Object> map)
      Deserializes a Receipt from a Map.
      Parameters:
      map - Map to deserialize from
      Returns:
      Deserialized Receipt