Package com.olziedev.playerauctions.api
Class PlayerAuctionsAPI
java.lang.Object
com.olziedev.playerauctions.api.PlayerAuctionsAPI
The main class for accessing and using the API.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract ItemStack
createConfigItem
(ConfigurationSection section, boolean containsTag) Use the plugin create item method for all type item creation support.abstract void
createPlayerAuction
(double price, Integer amount, ACurrency currency, APlayer seller, AProduct<?> productProvider, boolean bid, Consumer<Auction> callback) Creates a player auction with the product specified.abstract void
createPlayerAuction
(double price, Integer amount, APlayer seller, AProduct<?> productProvider, boolean bid, Consumer<Auction> callback) Creates a player auction with the product specified.abstract void
createSafePlayerAuction
(double price, Integer amount, ACurrency currency, APlayer seller, AProductProvider<?> productProvider, boolean bid, Consumer<Auction> callback) Creates a player auction with product specified.abstract void
createSafePlayerAuction
(double price, Integer 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 ExpansionRegistry
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 void
sendMessage
(CommandSender sender, String message) Use the plugin send message method for all type of syntax support.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.
-
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, Integer amount, APlayer seller, AProduct<?> productProvider, boolean bid, Consumer<Auction> callback) Creates a player auction with the product specified.- Parameters:
price
- The price of the auction.amount
- The amount of the product.seller
- The seller of the auction.productProvider
- 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, Integer amount, ACurrency currency, APlayer seller, AProduct<?> productProvider, boolean bid, Consumer<Auction> callback) Creates a player auction with the product specified.- Parameters:
price
- The price of the auction.amount
- The amount of the product.currency
- The currency to use for this auction.seller
- The seller of the auction.productProvider
- 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, Integer 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.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, Integer amount, ACurrency currency, 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.currency
- The 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.
-
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.
-
getExpansionRegistry
- Returns:
- The expansion registry to manage the plugin expansions.
-
getCommandRegistry
- Returns:
- The command registry to manage the plugin sub-commands.
-
sendMessage
Use the plugin send message method for all type of syntax support.- Parameters:
sender
- The entity who will receive the message.message
- The message.
-
createConfigItem
Use the plugin create item method for all type item creation support.- Parameters:
section
- The configuration section to get the item from.containsTag
- If the item contains a tag.- Returns:
- The item from the configuration section.
-
getAuctionSortType
- Returns:
- The default auction sort type from the configuration.
-