Artillex-Studios Documentation Help

Developer API

Add the following to your repositories section:

maven { url 'https://repo.artillex-studios.com/releases/' }

Add the dependency to your dependencies section:

compileOnly("com.artillexstudios:AxAuctionsAPI:CHANGE-THIS")

Add the following to your repositories section:

<repository> <id>Artillex-Studios</id> <url>https://repo.artillex-studios.com/releases/</url> </repository>

Add the following to your dependencies section:

<dependency> <groupId>com.artillexstudios</groupId> <artifactId>AxAuctionsAPI</artifactId> <version>CHANGE-THIS</version> <scope>provided</scope> </dependency>

Replace CHANGE-THIS to the latest version: Ax auctions api color 40c14a amp name ax auctions api

API Usage

Don't forget to add AxAuctions to your plugin's plugin.yml, like this:

depend: - AxAuctions

or:

softdepend: - AxAuctions

Events:

Event

Description

AxAuctionsLoadEvent

Called when the plugin is loaded (!! all hooks must be registered at this event)

AxAuctionsPurchaseEvent

Called when someone buys an item

AxAuctionsPreSellEvent

Called before the player puts something on the auction house

AxAuctionsSellEvent

When a player puts something on the auction house

Adding your own currency:

Create a new class and make it implement com.artillexstudios.axauctions.hooks.currency.CurrencyHook, it should look something like this:

public class ExampleCurrency implements CurrencyHook { @Override public void setup() { // this only gets called once when the hook gets registered } @Override public String getName() { // the name of your hook, used for the currencies.yml // this should not contain any special characters - underscores (_) and dashes (-) are fine return "ExampleCurrency"; } @Override public boolean worksOffline() { // does your hook work with offline players? return false; } @Override public boolean usesDouble() { // does your hook work uses double/float or not? return false; } @Override public boolean isPersistent() { // should the plugin unregister the hook when the AxAuctions gets reloaded? // you should keep this on true return true; } @Override public double getBalance(@NotNull UUID player) { // your code here return 0; } @Override public CompletableFuture<Boolean> giveBalance(@NotNull UUID player, double amount) { CompletableFuture<Boolean> cf = new CompletableFuture<>(); // your code here cf.complete(true); // make sure to return true if the transaction the successfully completed! (or false if it failed) if your plugin doesn't use async tasks, just complete with a true value return cf; } @Override public CompletableFuture<Boolean> takeBalance(Consumer<Boolean> successful, @NotNull UUID player, double amount) { CompletableFuture<Boolean> cf = new CompletableFuture<>(); // your code here cf.complete(true); // make sure to return true if the transaction the successfully completed! (or false if it failed) if your plugin doesn't use async tasks, just complete with a true value return cf; } }

Next is, check the currencies.yml, there should be something like this generated for your own currency:

ExampleCurrency: # < the name of your currency register: true tax: 0 display: # the way the currency will be shown in the lores of the auction gui gui: "&f%price% &#AAFFFFcoins" # used in the currency switcher and tab completion raw: "My Currency" # the item shown in the currency selector item: material: GOLD_INGOT name: "&#00DDFFMy Currency" lore: - " " - "&#00DDFF&l(!) &#00DDFFClick here to select!"

Create your implementation for all these methods, after that is done, you will have to register it by using the com.artillexstudios.axauctions.hooks.HookManager.registerCurrencyHook() method, for the plugin parameter give the instance of your plugin's main class.

And if all of this is done, congratulations, you have added a new currency to AxAuctions!

Last modified: 27 December 2024