Package com.olziedev.playerauctions.api
Class PlayerAuctionsAPI
java.lang.Object
com.olziedev.playerauctions.api.PlayerAuctionsAPI
- All Implemented Interfaces:
PluginAPI
The main class for accessing and using the API.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
createPlayerAuction
(double price, ACurrency currency, String internalCurrency, APlayer seller, AProduct<?> product, boolean bid, Consumer<Auction> callback) Creates a player auction with the product specified.abstract void
createPlayerAuction
(double price, APlayer seller, AProduct<?> product, boolean bid, Consumer<Auction> callback) Creates a player auction with the product specified.abstract void
createSafePlayerAuction
(double price, Long amount, ACurrency currency, String internalCurrency, APlayer seller, AProductProvider<?> productProvider, boolean bid, Consumer<Auction> callback) Creates a player auction with product specified.abstract void
createSafePlayerAuction
(double price, Long amount, APlayer seller, AProductProvider<?> productProvider, boolean bid, Consumer<Auction> callback) Creates a player auction with product specified.abstract ACategory
getAuctionCategory
(String category) abstract APlayer
getAuctionPlayer
(UUID uuid) abstract AuctionSortType
abstract CommandRegistry
abstract AProductProvider
<?> static PlayerAuctionsAPI
static void
Waits for the instance of the API when it is ready.abstract Auction
getPlayerAuction
(long id, CommandSender sender) getPlayerAuctions
(CommandSender sender) abstract Auction
updateAuction
(long id, UUID uuid) Updates the current auction with its new data, if the auction doesn't exist then a new auction object will be created and added to the cache automatically.abstract APlayer
updateAuctionPlayer
(UUID uuid) Updates the current player with its new data, if the player isn't in cache then it won't do anything and return null.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.olziedev.playerauctions.api.PluginAPI
createConfigItem, getExpansionRegistry, getPlugin, sendMessage
-
Constructor Details
-
PlayerAuctionsAPI
public PlayerAuctionsAPI()
-
-
Method Details
-
getInstance
- Returns:
- The instance of the API.
-
getInstance
Waits for the instance of the API when it is ready.- Parameters:
api
- Callback with the instance of the API.
-
getPlayerAuction
- Parameters:
id
- The id of the auction to get.sender
- The command sender, this is to check if they can see specific auctions or not.- Returns:
- The requested auction object.
-
createPlayerAuction
public abstract void createPlayerAuction(double price, APlayer seller, AProduct<?> product, boolean bid, Consumer<Auction> callback) Creates a player auction with the product specified.- Parameters:
price
- The price of the auction.seller
- The seller of the auction.product
- The product to use.bid
- If the auction type is a bid.callback
- Callback of the created auction instance.
-
createPlayerAuction
public abstract void createPlayerAuction(double price, ACurrency currency, String internalCurrency, APlayer seller, AProduct<?> product, boolean bid, Consumer<Auction> callback) Creates a player auction with the product specified.- Parameters:
price
- The price of the auction.currency
- The currency to use for this auction, can be null to use the default currency or usecreatePlayerAuction(double, APlayer, AProduct, boolean, Consumer)
.internalCurrency
- The internal currency to use for this auction, can be null to use the default currency or usecreatePlayerAuction(double, APlayer, AProduct, boolean, Consumer)
.seller
- The seller of the auction.product
- The product to use.bid
- If the auction type is a bid.callback
- Callback of the created auction instance.
-
createSafePlayerAuction
public abstract void createSafePlayerAuction(double price, Long amount, APlayer seller, AProductProvider<?> productProvider, boolean bid, Consumer<Auction> callback) Creates a player auction with product specified. (using the checks the sell command uses).- Parameters:
price
- The price of the auction.amount
- The amount of the product, can be null to just use the actual amount of the product.seller
- The seller of the auction.productProvider
- The product provider to use.bid
- If the auction type is a bid.callback
- Callback of the created auction instance.
-
createSafePlayerAuction
public abstract void createSafePlayerAuction(double price, Long amount, ACurrency currency, String internalCurrency, APlayer seller, AProductProvider<?> productProvider, boolean bid, Consumer<Auction> callback) Creates a player auction with product specified. (using the checks the sell command uses).- Parameters:
price
- The price of the auction.amount
- The amount of the product, can be null to just use the actual amount of the product.currency
- The currency to use for this auction.internalCurrency
- The internal currency to use for this auction.seller
- The seller of the auction.productProvider
- The product provider to use.bid
- If the auction type is a bid.callback
- Callback of the created auction instance.
-
getDefaultProductProvider
- Returns:
- The default product provider to use when creating auctions.
-
getPlayerAuctions
- Returns:
- List of the active auctions on the server.
-
getPlayerAuctions
- Parameters:
sender
- The command sender, this is to check if they can see specific auctions or not.- Returns:
- List of the active auctions on the server.
-
updateAuction
Updates the current auction with its new data, if the auction doesn't exist then a new auction object will be created and added to the cache automatically.- Parameters:
id
- An existing auction that needs to be updated.uuid
- The owner of the existing auction.- Returns:
- The new updated cache version of the auction object.
-
updateAuctionPlayer
Updates the current player with its new data, if the player isn't in cache then it won't do anything and return null.- Parameters:
uuid
- The player's UUID to update.- Returns:
- The new updated cache version of the player object.
-
getAuctionCategory
- Parameters:
category
- The category name.- Returns:
- The requested category object.
-
getAuctionCategories
- Returns:
- List of the currently loaded auction categories.
-
getAuctionPlayer
- Parameters:
uuid
- The uuid of a player to get.- Returns:
- The requested auction player object.
-
getAuctionPlayers
- Returns:
- List of the currently loaded auction players.
-
getCommandRegistry
- Returns:
- The command registry to manage the plugin sub-commands.
-
getAuctionSortType
- Returns:
- The default auction sort type from the configuration.
-