API/EconomyInterface

Code snapshot for the EconomyInterface

Subject to change till 0.4.0 and again till release: The interfaces will get changed slightly.

package asofold.admittance.interfaces;

import org.bukkit.entity.Player;

/**
 * Very simplish.
 * @author dummy
 *
 */
public interface EconomyInterface extends PublicInterface{
	
	/**
	 * 
	 * @param player
	 * @param amount
	 * @param currency
	 * @return has or has not enough
	 */
	public boolean hasEnough(Player player, double amount, String currency);
	
	/**
	 * Check if the player has an account for this currency.
	 * @param playerName
	 * @param currency
	 * @return shas or has not account
	 */
	public boolean hasAccount(String playerName, String currency);
	
	/**
	 * This assumes that the account is created, if players exist.
	 * @param sender
	 * @param receiverName
	 * @param amount
	 * @param currency
	 * @return success
	 */
	public boolean transfer(Player sender, String receiverName, double amount, String currency);
	
	/**
	 * Check if the currency is valid.
	 * @param currency
	 * @return if accepted
	 */
	public boolean isAcceptedCurrency(String currency);
	
	/**
	 * Default currency will be used, if no currency is specified for a transaction.
	 * @return name of the default currency
	 */
	public String getDefaultCurrency();
	

}

There is an abstract class that might help implementing a simple economy: asofold.admittance.interfaces.impl.economy.SimpleEconomy

Only a few methods have to be implemented, the messaging to the players is already present in transfer, leaving the low level stuff to you. The implementation is subject to change, due to upcoming additions like language-configurability.

<<code java>>

<</code>>

Comments

Posts Quoted:
Reply
Clear All Quotes