Developer API
Javadocs & Access
API for integrating with the DeluxeWithdraw plugin.
Maven Integration
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.N0RSKA</groupId>
<artifactId>DeluxeWithdrawAPI</artifactId>
<version>REPLACE WITH JITPACK VERSION</version>
</dependency>
</dependencies>
Links
Creating Addons (Custom Currencies)
To implement a custom economy/currency, you need to create an addon plugin with the API (links above). Your plugin needs to depend on DeluxeWithdraw and load after it. You will find code examples below.
IMPORTANT! In order for everything to be tidy, if you make a custom addon with a configuration file, it should be generated at this path /plugins/DeluxeWithdraw/addons
.
- Create a class that implements
DWAddonInterface
. - 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 DWAddonInterface {
@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 Boolean has(Player p, Double amount) {
return CustomCurrency.getBalance(p) >= amount;
}
@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 Boolean has(Player p, Integer amount) { return null; }
@Override
public String currencyString() {
return " exp";
}
@Override
public int currencyFormat() {
return 1;
}
@Override
public Double getCurrent(Player p) {
return CustomCurrency.getBalance(p);
}
@Override
public List<String> withdrawCommands() {
return Arrays.asList("xpbottle", "expbottle");
}
@Override
public Double minWithdraw() {
return 10;
}
@Override
public Double maxWithdraw() {
return 50;
}
@Override
public String layout() {
return "exp_default";
}
@Override
public String adminCreator() {
return "Server Name?"
}
@Override
public void reloadConfiguration() {
CustomPlugin.reloadConfiguration();
}
}
- Register the new addon. Use CAPS!
DeluxeWithdraw.getInstance().getAddonProvider().registerNewProvider("CUSTOM", new CustomProvider());
- Configure an item to use your new provider. Go into items.yml and set the provider. ("CUSTOM" in this case) Path:
items.<item>.settings.provider
Addon List
Find official/unofficial addons for DeluxeWithdraw here.