LegendCoins API

LegendCoins API:

At first, plugin have 3 classes with API methods.

EconomyManager:

You must make new EconomyManager class:

EconomyManager em = new EconomyManager();

To make an economy player account, you can use makeAccount() method. It think, you don't need it, because plugin makes player count, when player joins.

makeAccount() method:

Example:

EconomyPlayer ep = em.makeAccount(player.getName());

It will make a player account, and return it to you. EconomyPlayer account method setBalance() doesn't saving player balance to database. If you want to set player balance, use EconomyManager's balance methods.

removeAccount() method:

There you can delete player account from database.

Example:

em.removeAccount(player.getName());

addMoney() method:

Method for adding money to account

Example:

em.addMoney(player.getName(), 50);

removeMoney() method:

Method for removing money from account

Example:

em.removeMoney(player.getName(), 50);

setMoney() method:

Method for setting money in account

Example:

em.setMoney(player.getName(), 50);

setDoubleCoins() method:

Method for setting double-coins. If double coins set to true, people will get 2x coins from addMoney() method!

Example:

em.setDoubleCoins(true);

getDoubleCoins() method:

Returns true if double-coins launched.

Example:

boolean yep = em.getDoubleCoins();

getPlayerByName() method:

Returns player by his name.

Example:

EconomyPlayer ep = em.getPlayerByName("xBeLkAx");

getPlayerById() method:

Returns player by his id.

Example:

EconomyPlayer ep = em.getPlayerById(1);

EconomyPlayer:

getName() and getId() methods are simple to use. I won't post it here.

getBalance() method:

Returns player balance.

Example:

EconomyPlayer ep = em.getPlayerByName("xBeLkAx"); // Or you can get player by ID

int money = ep.getBalance();

Or

EconomyPlayer ep = em.makeAccount("xBeLkAx"); // Or you can get player by ID

int money = ep.getBalance();

setBalance() is just plugin method, and I don't recommend you to play with it.

ExchangeCommand:

This class made for /change command. There you can see 4 static methods.

getRateBuy() method:

Returns buy rate.

int rate = ExchangeCommand.getRateBuy();

getRateSell() method:

Returns sell rate.

int rate = ExchangeCommand.getRateSell();

setRateBuy() method:

Set buy rate for the plugin.

ExchangeCommand.setRateBuy(9001);

setRateSell() method:

Set sell rate for the plugin.

ExchangeCommand.setRateSell(9001);

Comments

Posts Quoted:
Reply
Clear All Quotes