2011-06-14 15:07:44 +02:00
|
|
|
package com.nijikokun.register.payment.forChestShop;
|
2011-05-15 18:16:25 +02:00
|
|
|
|
|
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
|
2011-05-16 17:35:12 +02:00
|
|
|
/**
|
2011-08-13 12:08:34 +02:00
|
|
|
* Interface to be implemented by a payment method.
|
2011-05-16 17:35:12 +02:00
|
|
|
*
|
2011-08-13 12:08:34 +02:00
|
|
|
* @author Nijikokun <nijikokun@shortmail.com> (@nijikokun)
|
|
|
|
* @copyright Copyright (C) 2011
|
|
|
|
* @license AOL license <http://aol.nexua.org>
|
2011-05-16 17:35:12 +02:00
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public interface Method {
|
2011-08-13 12:08:34 +02:00
|
|
|
/**
|
|
|
|
* Encodes the Plugin into an Object disguised as the Plugin.
|
|
|
|
* If you want the original Plugin Class you must cast it to the correct
|
|
|
|
* Plugin, to do so you have to verify the name and or version then cast.
|
|
|
|
*
|
|
|
|
* <pre>
|
|
|
|
* if(method.getName().equalsIgnoreCase("iConomy"))
|
|
|
|
* iConomy plugin = ((iConomy)method.getPlugin());</pre>
|
|
|
|
*
|
|
|
|
* @return <code>Object</code>
|
|
|
|
* @see #getName()
|
|
|
|
* @see #getVersion()
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public Object getPlugin();
|
2011-08-13 12:08:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the actual name of this method.
|
|
|
|
*
|
|
|
|
* @return <code>String</code> Plugin name.
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public String getName();
|
2011-08-13 12:08:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the actual version of this method.
|
|
|
|
*
|
|
|
|
* @return <code>String</code> Plugin version.
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public String getVersion();
|
2011-08-13 12:08:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Formats amounts into this payment methods style of currency display.
|
|
|
|
*
|
|
|
|
* @param amount Double
|
|
|
|
* @return <code>String</code> - Formatted Currency Display.
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public String format(double amount);
|
2011-08-13 12:08:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allows the verification of bank API existence in this payment method.
|
|
|
|
*
|
|
|
|
* @return <code>boolean</code>
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public boolean hasBanks();
|
2011-08-13 12:08:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determines the existence of a bank via name.
|
|
|
|
*
|
|
|
|
* @param bank Bank name
|
|
|
|
* @return <code>boolean</code>
|
|
|
|
* @see #hasBanks
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public boolean hasBank(String bank);
|
2011-08-13 12:08:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determines the existence of an account via name.
|
|
|
|
*
|
|
|
|
* @param name Account name
|
|
|
|
* @return <code>boolean</code>
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public boolean hasAccount(String name);
|
2011-08-13 12:08:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check to see if an account <code>name</code> is tied to a <code>bank</code>.
|
|
|
|
*
|
|
|
|
* @param bank Bank name
|
|
|
|
* @param name Account name
|
|
|
|
* @return <code>boolean</code>
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public boolean hasBankAccount(String bank, String name);
|
2011-08-13 12:08:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a <code>MethodAccount</code> class for an account <code>name</code>.
|
|
|
|
*
|
|
|
|
* @param name Account name
|
|
|
|
* @return <code>MethodAccount</code> <em>or</em> <code>Null</code>
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public MethodAccount getAccount(String name);
|
2011-08-13 12:08:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a <code>MethodBankAccount</code> class for an account <code>name</code>.
|
|
|
|
*
|
|
|
|
* @param bank Bank name
|
|
|
|
* @param name Account name
|
|
|
|
* @return <code>MethodBankAccount</code> <em>or</em> <code>Null</code>
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public MethodBankAccount getBankAccount(String bank, String name);
|
2011-08-13 12:08:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks to verify the compatibility between this Method and a plugin.
|
|
|
|
* Internal usage only, for the most part.
|
|
|
|
*
|
|
|
|
* @param plugin Plugin
|
|
|
|
* @return <code>boolean</code>
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public boolean isCompatible(Plugin plugin);
|
2011-08-13 12:08:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set Plugin data.
|
|
|
|
*
|
|
|
|
* @param plugin Plugin
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public void setPlugin(Plugin plugin);
|
|
|
|
|
2011-08-13 12:08:34 +02:00
|
|
|
/**
|
|
|
|
* Contains Calculator and Balance functions for Accounts.
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public interface MethodAccount {
|
|
|
|
public double balance();
|
|
|
|
public boolean set(double amount);
|
|
|
|
public boolean add(double amount);
|
|
|
|
public boolean subtract(double amount);
|
|
|
|
public boolean multiply(double amount);
|
|
|
|
public boolean divide(double amount);
|
|
|
|
public boolean hasEnough(double amount);
|
|
|
|
public boolean hasOver(double amount);
|
|
|
|
public boolean hasUnder(double amount);
|
|
|
|
public boolean isNegative();
|
|
|
|
public boolean remove();
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString();
|
|
|
|
}
|
|
|
|
|
2011-08-13 12:08:34 +02:00
|
|
|
/**
|
|
|
|
* Contains Calculator and Balance functions for Bank Accounts.
|
|
|
|
*/
|
2011-05-15 18:16:25 +02:00
|
|
|
public interface MethodBankAccount {
|
|
|
|
public double balance();
|
|
|
|
public String getBankName();
|
|
|
|
public int getBankId();
|
|
|
|
public boolean set(double amount);
|
|
|
|
public boolean add(double amount);
|
|
|
|
public boolean subtract(double amount);
|
|
|
|
public boolean multiply(double amount);
|
|
|
|
public boolean divide(double amount);
|
|
|
|
public boolean hasEnough(double amount);
|
|
|
|
public boolean hasOver(double amount);
|
|
|
|
public boolean hasUnder(double amount);
|
|
|
|
public boolean isNegative();
|
|
|
|
public boolean remove();
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString();
|
|
|
|
}
|
|
|
|
}
|