API - ThisKarolGajda/OpEconomy GitHub Wiki
Application programming interface for OpEconomy.
First step
Before you can use plugin, you need to import it to your project.
Import with maven:
N/A
Import with file:
- Download latest release file
- Put it in Libraries to your plugin
- That's all!
Using API:
Example of onEnable method
private OpEconomyApi API;
@Override
public void onEnable() {
if (Bukkit.getPluginManager().getPlugin("OpEconomy") == null){
getLogger().warn("Could not find required plugin: OpEconomy.");
Bukkit.getPluginManager().disablePlugin(this);
} else {
API = new OpEconomyApi();
}
}
Methods
- Getting balance of Player object -
public int getBalance(Player player)
- Getting balance from UUID -
public int getBalance(UUID uuid)
- Adding money to UUID -
public void addMoney(UUID uuid, int amount)
- Remove money from UUID -
public void removeMoney(UUID uuid, int amount)
- Get Timewatch class object -
public TimeWatch getTimeWatch()
- Get active Currency -
public String getActiveCurrency()
- Set active Currency -
public void setActiveCurrency(String newCurrency)
- Create new Redeem Code -
public void createRedeemCode(String string, int maxUses, int reward)
- Is code valid -
public void isValidCodeEntered(String code, Player player)
- Has player redeem code already -
public boolean hasPlayerRedeemedCode(String code, Player player)