Skip to main content

Developer API

Javadocs & Access

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

JavaDocs can be found here. Maven/Gradle/SBT/Leiningen can be found here.

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 GambleBombs and load after it. You will find code examples below.

  1. Create a class that implements GambleBombsEcoInterface.
  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 GambleBombsEcoInterface {

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

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

@Override
public void set(Player p, Double amount) {}

@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) {}

@Override
public String currencyString() {
return "$";
}

@Override
public int currencyFormat() {
return 1;
}

@Override
public Double getCurrent(Player p) {
return CustomCurrency.getBalance(p);
}

}
  1. Register the new provider.
GambleBombs.getInstance().getEconProvider().registerNewProvider("CUSTOM", new CustomProvider());
  1. Configure a gamble bomb to use your new provider. Go into items.yml and set the provider. ("CUSTOM" in this case) Path: items.bombs.<bomb>.settings.provider