Class Receipt
java.lang.Object
us.teaminceptus.novaconomy.api.economy.market.Receipt
- All Implemented Interfaces:
Serializable,ConfigurationSerializable
Utility class for keeping track of purchased items on the Market
- Since:
- 1.7.1
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionReceipt(@NotNull Material purchased, double purchasePrice, int purchaseAmount, @NotNull OfflinePlayer player) Constructs a new Market Receipt.Receipt(@NotNull Material purchased, double purchasePrice, int purchaseAmount, @NotNull OfflinePlayer player, @NotNull Date timestamp) Constructs a new Market Receipt. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Receiptdeserialize(@NotNull Map<String, Object> map) Deserializes a Receipt from a Map.intFetches the amount of the Material purchased.@NotNull MaterialFetches the Material purchased.doubleFetches the total price of the purchase.@NotNull OfflinePlayerFetches the player who purchased the Material.doubleFetches how much the Material was purchased for, without factoring in the amount.@NotNull DateFetches the timestamp of the purchase.booleanisRecent()Checks if the purchase was recent.
-
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 purchasedpurchasePrice- Price of the MaterialpurchaseAmount- Amount of the Material purchasedplayer- 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 purchasedpurchasePrice- Price of the MaterialpurchaseAmount- Amount of the Material purchasedplayer- Player who purchased the Materialtimestamp- Timestamp of the purchase
-
-
Method Details
-
getPurchaser
Fetches the player who purchased the Material.- Returns:
- Player who purchased the 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
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
- Specified by:
serializein interfaceConfigurationSerializable
-
deserialize
Deserializes a Receipt from a Map.- Parameters:
map- Map to deserialize from- Returns:
- Deserialized Receipt
-