Class PlayerAuctionsAPI

java.lang.Object
com.olziedev.playerauctions.api.PlayerAuctionsAPI

public abstract class PlayerAuctionsAPI extends Object
The main class for accessing and using the API.
  • Constructor Details

    • PlayerAuctionsAPI

      public PlayerAuctionsAPI()
  • Method Details

    • getInstance

      public static PlayerAuctionsAPI getInstance()
      Returns:
      The instance of the API.
    • getInstance

      public static void getInstance(Consumer<PlayerAuctionsAPI> api)
      Waits for the instance of the API when it is ready.
      Parameters:
      api - Callback with the instance of the API.
    • getPlayerAuction

      public abstract Auction getPlayerAuction(long id, CommandSender sender)
      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

      public abstract List<Auction> getPlayerAuctions()
      Returns:
      List of the active auctions on the server.
    • getPlayerAuctions

      public abstract List<Auction> getPlayerAuctions(CommandSender sender)
      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

      public 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.
      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

      public 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.
      Parameters:
      uuid - The player's UUID to update.
      Returns:
      The new updated cache version of the player object.
    • getAuctionCategory

      public abstract ACategory getAuctionCategory(String category)
      Parameters:
      category - The category name.
      Returns:
      The requested category object.
    • getAuctionCategories

      public abstract List<ACategory> getAuctionCategories()
      Returns:
      List of the currently loaded auction categories.
    • getAuctionPlayer

      public abstract APlayer getAuctionPlayer(UUID uuid)
      Parameters:
      uuid - The uuid of a player to get.
      Returns:
      The requested auction player object.
    • getAuctionPlayers

      public abstract List<APlayer> getAuctionPlayers()
      Returns:
      List of the currently loaded auction players.
    • getExpansionRegistry

      public abstract ExpansionRegistry getExpansionRegistry()
      Returns:
      The expansion registry to manage the plugin expansions.
    • getCommandRegistry

      public abstract CommandRegistry getCommandRegistry()
      Returns:
      The command registry to manage the plugin sub-commands.
    • sendMessage

      public abstract void sendMessage(CommandSender sender, String message)
      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

      public abstract ItemStack createConfigItem(ConfigurationSection section, boolean containsTag)
      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

      public abstract AuctionSortType getAuctionSortType()
      Returns:
      The default auction sort type from the configuration.