Class Auction
java.lang.Object
com.olziedev.playerauctions.api.auction.Auction
- Direct Known Subclasses:
ARecent
Represents a player auction that can manage and handle basic data within an auction.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidAdds a bidder.abstract voidPurchases this auction.abstract longabstract APlayerabstract Stringabstract APlayerabstract doublegetBuyPrice(long amount, boolean containsFee) abstract ACurrencyRetrieve the currency for this auction.abstract longabstract longgetID()abstract StringRetrieve the internal currency for this auction.abstract ItemStackgetItem()abstract longabstract doubleabstract StringgetPrettyItemName(boolean showDisplayName) abstract ItemStack[]getPreviewItems(boolean filter) abstract doublegetPrice()abstract longabstract ASerializableProduct<?> abstract UUIDgetUUID()abstract StringgetWorld()abstract booleanabstract booleanabstract booleanabstract voidremoveAuction(PlayerAuctionRemoveEvent.Cause cause, Consumer<AuctionResponse> runnable, CommandSender remover) Removes the auction from the server.replaceLore(List<String> s, CommandSender viewer) abstract voidsetAuctionPlayer(APlayer auctionPlayer) Modifies the auction owner.abstract voidsetExpireTime(Long expire, Consumer<AuctionResponse> runnable, Player player) Modifies the expiry time when the auction should expire.abstract voidsetPrice(double price) abstract voidsetProduct(ASerializableProduct<?> serializableProduct, long amount) Modifies the item stack of the auction.abstract voidsetRandomSort(long randomSort) Sets the random sort ID of this auction.
-
Constructor Details
-
Auction
public Auction()
-
-
Method Details
-
getID
public abstract long getID()- Returns:
- The unique ID of the auction.
-
getUUID
- Returns:
- The owner's UUID of this auction.
-
getAuctionPlayer
- Returns:
- The owner of this auction.
-
getItem
- Returns:
- The item that is shown to players.
-
getSerializableProduct
- Returns:
- The auctioned product.
-
getPrettyItemName
- Parameters:
showDisplayName- If item has a display name, it'll return the item name. (coloured)- Returns:
- The pretty item name.
-
getAuctionCategories
- Returns:
- The categories of this auction based off the item.
-
getExpireTime
public abstract long getExpireTime()- Returns:
- The time when the auction will expire in milliseconds.
-
getAuctionDate
public abstract long getAuctionDate()- Returns:
- The creation date of this auction in milliseconds.
-
hasExpired
public abstract boolean hasExpired()- Returns:
- If the auction has expired.
-
setExpireTime
Modifies the expiry time when the auction should expire.- Parameters:
expire- The amount of time the auction should expire.runnable- The callback when the method is done.player- The player that set the expiry time.
-
getItemAmount
public abstract long getItemAmount()- Returns:
- The amount of items that the auction has.
-
setProduct
Modifies the item stack of the auction.- Parameters:
serializableProduct- The product of the auction.amount- The amount for the auction item.
-
getPrice
public abstract double getPrice()- Returns:
- The current amount of the auction cost.
-
getOriginalPrice
public abstract double getOriginalPrice()- Returns:
- The price it was originally sold as, before the plugin modified the value.
-
getCurrency
Retrieve the currency for this auction.- Returns:
- The type of currency that this auction was chosen to use.
-
getInternalCurrency
Retrieve the internal currency for this auction.- Returns:
- The internal currency name.
-
getAuctionServer
- Returns:
- The server where the auction was created.
-
getWorld
- Returns:
- The name of the world the warp is located in.
-
setPrice
public abstract void setPrice(double price) - Parameters:
price- The amount the auction should cost.
-
setAuctionPlayer
Modifies the auction owner.- Parameters:
auctionPlayer- The new auction owner.
-
isBidding
public abstract boolean isBidding()- Returns:
- If the auction is a bid or not.
-
addBidder
Adds a bidder.- Parameters:
auctionPlayer- The bidder.price- The offered price.callback- The callback when the method is finished.
-
getBidder
- Returns:
- The current bidder that has offered the most.
-
getBuyPrice
public abstract double getBuyPrice(long amount, boolean containsFee) - Parameters:
amount- The amount of items to get the price ofcontainsFee- If the price should include the fee or not.- Returns:
- The price of all the items
-
getPreviewItems
- Parameters:
filter- Should it remove air items from the returned array.- Returns:
- The array of the preview items for that auction.
-
buy
Purchases this auction.- Parameters:
buyer- The buyer.amount- The amount of items the player wants to buy.consumer- The callback when the method is done, this will return internally if the previous inventory should be opened.
-
getRandomSort
public abstract long getRandomSort()- Returns:
- The random sort ID of this auction.
-
setRandomSort
public abstract void setRandomSort(long randomSort) Sets the random sort ID of this auction.- Parameters:
randomSort- The new random sort ID of this auction.
-
removeAuction
public abstract void removeAuction(PlayerAuctionRemoveEvent.Cause cause, Consumer<AuctionResponse> runnable, CommandSender remover) Removes the auction from the server.- Parameters:
cause- What caused the auction to be removed for thePlayerAuctionRemoveEventevent.runnable- The callback when the method is done.remover- The user who removed the auction.
-
isUnlimited
public abstract boolean isUnlimited()- Returns:
- If the auction is unlimited.
-
replaceLore
- Parameters:
s- The string that will be replaced with the needed variables.viewer- The sender that is viewing the auction.- Returns:
- The new string with the new variables.
-