Auction Product

Here you can view details on how to create a product addon using the Expansions API.

In Player Auctions you can create a product addon that will allow you to create a new product type. This will allow you to create a new product type that will be able to be sold on the auction house.

Registering

You can go here to learn on how to register an expansion.

Examples

Here is an example of a product addon class, this will let you be able to create a new product type.

public class ProductExample extends AProductProvider<String> {
    
    @Override
    public void giveProduct(AProduct<String> aProduct, Player player) {
        
    }

    @Override
    public boolean isInvalidProduct(AProduct<String> product, Player player) {
        return false;
    }

    @Override
    public boolean isDamagedProduct(AProduct<String> product, Player player) {
        return false;
    }

    @Override
    public boolean isCorrect(AProduct<String> product, Player player) {
        return false;
    }

    @Override
    public boolean isSimilarProduct(ASerializableProduct<?> product, ASerializableProduct<?> other) {
        return false;
    }

    @Override
    public void takeProduct(AProduct<String> product, Player player) {

    }

    @Override
    public AProduct<String> setupProduct(Long amount, Player player) {
        return null;
    }

    @Override
    public AProduct<String> setupProduct(Long amount, String s) {
        return null;
    }

    @Override
    public ASerializableProduct<String> getSerializableProduct(byte[] bytes) {
        return null;
    }

    @Override
    public ItemStack getIcon(AProduct<String> product) {
        return null;
    }

    @Override
    public List<ACategory> getCategories(AProduct<String> product) {
        return null;
    }

    @Override
    public List<ACategory> getCategories(String product) {
        return null;
    }

    @Override
    public String getProductName(AProduct<String> product, FileConfiguration configuration, FileConfiguration lang, boolean showDisplayName) {
        return null;
    }

    @Override
    public List<String> getItemLore(Auction auction, ConfigurationSection section) {
        return null;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

    @Override
    public String getName() {
        return "Example Expansion";
    }

    @Override
    public void onLoad() {

    }
}

A product addon class must extend the AProductProvider class. This class has a generic type that must be the type of the product you are creating. In this example we are creating a product that is a string.

The AProductProvider class has many methods that you must override. These methods are used to handle the product you are creating.

The giveProduct method is called when a player buys the product. This method is used to give the player the product.

The isInvalidProduct method is called when a player tries to buy the product. This method is used to check if the player can buy the product.

The isDamagedProduct method is called when a player tries to buy the product. This method is used to check if the product is damaged.

The isCorrect method is called when a player tries to buy the product. This method is used to check if the product is correct.

The isSimilarProduct method is called when a player tries to buy the product. This method is used to check if the product is similar to another product.

The takeProduct method is called when a player buys the product. This method is used to take the product from the player.

The setupProduct method is called when a player tries to buy the product. This method is used to setup the product.

The getSerializableProduct method is called when a player tries to buy the product. This method is used to get the serializable product.

The getIcon method is called when a player views the product. This method is used to get the icon of the product.

The getCategories method is called when a player views the product. This method is used to get the categories of the product.

The getProductName method is called when a player views the product. This method is used to get the name of the product.

The getItemLore method is called when a player views the product. This method is used to get the lore of the product.

Last updated