Premium

Developer API

DeluxeSellwands documentation

On this page

Javadocs & Access#

Retrieve DeluxeSellwands' instance by using DeluxeSellwands.getInstance().

JavaDocs can be found the API reference. Maven/Gradle/SBT/Leiningen can be found JitPack.

Implementing Custom Economy#

To implement a custom economy/currency, you need to create an addon plugin with the API (links above). Your plugin needs to depend on DeluxeSellwands and load after it. You will find code examples below.

  1. Create a class that implements DSWEconInterface.
  2. Add the unimplemented methods and edit them according to your custom currency. You can use both Doubles and Integers, if you are not going to be using a method you can leave it as empty.
public class CustomProvider implements DSWEconInterface {

	@Override
	public void take(Player p, Double amount) {
		CustomCurrency.take(p, 2500);
	}

	@Override
	public void add(Player p, Double amount) {
		CustomCurrency.add(p, 2500);
	}

	@Override
	public void set(Player p, Double amount) {
		CustomCurrency.set(p, 2500);
	}

	@Override
	public void take(Player p, Integer amount) {}

	@Override
	public void add(Player p, Integer amount) {}

	@Override
	public void set(Player p, Integer amount) {}
	
	@Override
	public String currencyString() {
		return "$";
	}
	
	@Override
	public int currencyFormat() {
		return 1;
	}
	
}
  1. Register the new provider.
DeluxeSellwands.getInstance().getEconProvider().registerNewProvider("CUSTOM", new CustomProvider());
  1. Create a class that implements DSWPriceHandlerInterface.

  2. Add the unimplemented methods and edit them according to your custom currency.

public class CustomPriceHandler implements DSWPriceHandlerInterface{

	@Override
	public Double getItemWorth(Player p, ItemStack item, int amount) {
		
		return CustomShopPlugin.getItemStackPriceSell(p, item);

	}

}
  1. Register the new price handler.
DeluxeSellwands.getInstance().getPriceHandler().registerNewPriceHandler("CUSTOM", new CustomPriceHandler());
  1. Configure a sellwand to use your new provider/pricehandler. Go into items.yml and set the provider. ("CUSTOM" in this case) Path: items.sellwands.<sellwand>.settings.provider

Currencies using Vault#

If your custom currency uses Vault as the provider, you do not need to create a new DSWEconInterface. Skip all steps till the 4th one and make sure to register the new price handler with the identifier set to "VAULT".

Still have a question? Get in touch →

Find your next answer.

Search the plugins and wiki.

↑ ↓ navigate · Enter openEsc close