mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Adding new register methods.
This commit is contained in:
parent
a04e0533d6
commit
614b7b84f7
4 changed files with 502 additions and 102 deletions
|
@ -65,7 +65,9 @@ file.reference.BOSEconomy7.jar=../lib/BOSEconomy7.jar
|
||||||
file.reference.craftbukkit-0.0.1-SNAPSHOT.jar=..\\lib\\craftbukkit-0.0.1-SNAPSHOT.jar
|
file.reference.craftbukkit-0.0.1-SNAPSHOT.jar=..\\lib\\craftbukkit-0.0.1-SNAPSHOT.jar
|
||||||
file.reference.iCo4.jar=../lib/iCo4.jar
|
file.reference.iCo4.jar=../lib/iCo4.jar
|
||||||
file.reference.iCo5.jar=../lib/iCo5.jar
|
file.reference.iCo5.jar=../lib/iCo5.jar
|
||||||
|
file.reference.iCo6.jar=../lib/iCo6.jar
|
||||||
file.reference.junit-4.5.jar=..\\lib\\junit_4\\junit-4.5.jar
|
file.reference.junit-4.5.jar=..\\lib\\junit_4\\junit-4.5.jar
|
||||||
|
file.reference.MultiCurrency.jar=../lib/MultiCurrency.jar
|
||||||
file.reference.Permissions3.jar=../lib/Permissions3.jar
|
file.reference.Permissions3.jar=../lib/Permissions3.jar
|
||||||
file.reference.PermissionsEx.jar=../lib/PermissionsEx.jar
|
file.reference.PermissionsEx.jar=../lib/PermissionsEx.jar
|
||||||
includes=**
|
includes=**
|
||||||
|
@ -77,6 +79,8 @@ javac.classpath=\
|
||||||
${file.reference.craftbukkit-0.0.1-SNAPSHOT.jar}:\
|
${file.reference.craftbukkit-0.0.1-SNAPSHOT.jar}:\
|
||||||
${file.reference.iCo4.jar}:\
|
${file.reference.iCo4.jar}:\
|
||||||
${file.reference.iCo5.jar}:\
|
${file.reference.iCo5.jar}:\
|
||||||
|
${file.reference.iCo6.jar}:\
|
||||||
|
${file.reference.MultiCurrency.jar}:\
|
||||||
${file.reference.BOSEconomy7.jar}:\
|
${file.reference.BOSEconomy7.jar}:\
|
||||||
${file.reference.PermissionsEx.jar}
|
${file.reference.PermissionsEx.jar}
|
||||||
# Space-separated list of extra javac options
|
# Space-separated list of extra javac options
|
||||||
|
|
|
@ -1,20 +1,37 @@
|
||||||
package com.earth2me.essentials.register.payment;
|
package com.earth2me.essentials.register.payment;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methods.java
|
* The <code>Methods</code> initializes Methods that utilize the Method interface
|
||||||
* Controls the getting / setting of methods & the method of payment used.
|
* based on a "first come, first served" basis.
|
||||||
*
|
*
|
||||||
* @author: Nijikokun<nijikokun@gmail.com> (@nijikokun)
|
* Allowing you to check whether a payment method exists or not.
|
||||||
|
*
|
||||||
|
* <blockquote><pre>
|
||||||
|
* Methods methods = new Methods();
|
||||||
|
* </pre></blockquote>
|
||||||
|
*
|
||||||
|
* Methods also allows you to set a preferred method of payment before it captures
|
||||||
|
* payment plugins in the initialization process.
|
||||||
|
*
|
||||||
|
* <blockquote><pre>
|
||||||
|
* Methods methods = new Methods("iConomy");
|
||||||
|
* </pre></blockquote>
|
||||||
|
*
|
||||||
|
* @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun)
|
||||||
* @copyright: Copyright (C) 2011
|
* @copyright: Copyright (C) 2011
|
||||||
* @license: GNUv3 Affero License <http://www.gnu.org/licenses/agpl-3.0.html>
|
* @license: AOL license <http://aol.nexua.org>
|
||||||
*/
|
*/
|
||||||
public class Methods {
|
public class Methods
|
||||||
|
{
|
||||||
private boolean self = false;
|
private boolean self = false;
|
||||||
private Method Method = null;
|
private Method Method = null;
|
||||||
private String preferred = "";
|
private String preferred = "";
|
||||||
|
@ -22,37 +39,71 @@ public class Methods {
|
||||||
private Set<String> Dependencies = new HashSet<String>();
|
private Set<String> Dependencies = new HashSet<String>();
|
||||||
private Set<Method> Attachables = new HashSet<Method>();
|
private Set<Method> Attachables = new HashSet<Method>();
|
||||||
|
|
||||||
public Methods() {
|
/**
|
||||||
|
* Initialize Method class
|
||||||
|
*/
|
||||||
|
public Methods()
|
||||||
|
{
|
||||||
this._init();
|
this._init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to set which economy plugin is most preferred.
|
* Initializes <code>Methods</code> class utilizing a "preferred" payment method check before
|
||||||
|
* returning the first method that was initialized.
|
||||||
*
|
*
|
||||||
* @param preferred - preferred economy plugin
|
* @param preferred Payment method that is most preferred for this setup.
|
||||||
*/
|
*/
|
||||||
public Methods(String preferred) {
|
public Methods(String preferred)
|
||||||
|
{
|
||||||
this._init();
|
this._init();
|
||||||
|
|
||||||
if(this.Dependencies.contains(preferred)) {
|
if (this.Dependencies.contains(preferred))
|
||||||
|
{
|
||||||
this.preferred = preferred;
|
this.preferred = preferred;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _init() {
|
/**
|
||||||
|
* Implement all methods along with their respective name & class.
|
||||||
|
*
|
||||||
|
* @see #Methods()
|
||||||
|
* @see #Methods(java.lang.String)
|
||||||
|
*/
|
||||||
|
private void _init()
|
||||||
|
{
|
||||||
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo4());
|
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo4());
|
||||||
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo5());
|
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo5());
|
||||||
|
this.addMethod("iConomy", new com.earth2me.essentials.register.payment.methods.iCo6());
|
||||||
this.addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE6());
|
this.addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE6());
|
||||||
this.addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE7());
|
this.addMethod("BOSEconomy", new com.earth2me.essentials.register.payment.methods.BOSE7());
|
||||||
|
this.addMethod("MultiCurrency", new com.earth2me.essentials.register.payment.methods.MCUR());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getDependencies() {
|
/**
|
||||||
|
* Returns an array of payment method names that have been loaded
|
||||||
|
* through the <code>_init</code> method.
|
||||||
|
*
|
||||||
|
* @return <code>Set<String></code> - Array of payment methods that are loaded.
|
||||||
|
* @see #setMethod(org.bukkit.plugin.Plugin)
|
||||||
|
*/
|
||||||
|
public Set<String> getDependencies()
|
||||||
|
{
|
||||||
return Dependencies;
|
return Dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Method createMethod(Plugin plugin) {
|
/**
|
||||||
for (Method method: Methods) {
|
* Interprets Plugin class data to verify whether it is compatible with an existing payment
|
||||||
if (method.isCompatible(plugin)) {
|
* method to use for payments and other various economic activity.
|
||||||
|
*
|
||||||
|
* @param plugin Plugin data from bukkit, Internal Class file.
|
||||||
|
* @return Method <em>or</em> Null
|
||||||
|
*/
|
||||||
|
public Method createMethod(Plugin plugin)
|
||||||
|
{
|
||||||
|
for (Method method : Methods)
|
||||||
|
{
|
||||||
|
if (method.isCompatible(plugin))
|
||||||
|
{
|
||||||
method.setPlugin(plugin);
|
method.setPlugin(plugin);
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
@ -61,77 +112,160 @@ public class Methods {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMethod(String name, Method method) {
|
private void addMethod(String name, Method method)
|
||||||
|
{
|
||||||
Dependencies.add(name);
|
Dependencies.add(name);
|
||||||
Methods.add(method);
|
Methods.add(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMethod() {
|
/**
|
||||||
|
* Verifies if Register has set a payment method for usage yet.
|
||||||
|
*
|
||||||
|
* @return <code>boolean</code>
|
||||||
|
* @see #setMethod(org.bukkit.plugin.Plugin)
|
||||||
|
* @see #checkDisabled(org.bukkit.plugin.Plugin)
|
||||||
|
*/
|
||||||
|
public boolean hasMethod()
|
||||||
|
{
|
||||||
return (Method != null);
|
return (Method != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setMethod(Plugin method) {
|
/**
|
||||||
if(hasMethod()) return true;
|
* Checks Plugin Class against a multitude of checks to verify it's usability
|
||||||
if(self) { self = false; return false; }
|
* as a payment method.
|
||||||
|
*
|
||||||
|
* @param method Plugin data from bukkit, Internal Class file.
|
||||||
|
* @return <code>boolean</code> True on success, False on failure.
|
||||||
|
*/
|
||||||
|
public boolean setMethod(Plugin method)
|
||||||
|
{
|
||||||
|
if (hasMethod())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (self)
|
||||||
|
{
|
||||||
|
self = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
boolean match = false;
|
boolean match = false;
|
||||||
Plugin plugin;
|
Plugin plugin = null;
|
||||||
PluginManager manager = method.getServer().getPluginManager();
|
PluginManager manager = method.getServer().getPluginManager();
|
||||||
|
|
||||||
for(String name: this.getDependencies()) {
|
for (String name : this.getDependencies())
|
||||||
if(hasMethod()) break;
|
{
|
||||||
if(method.getDescription().getName().equals(name)) plugin = method; else plugin = manager.getPlugin(name);
|
if (hasMethod())
|
||||||
if(plugin == null) continue;
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (method.getDescription().getName().equals(name))
|
||||||
|
{
|
||||||
|
plugin = method;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plugin = manager.getPlugin(name);
|
||||||
|
}
|
||||||
|
if (plugin == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Method current = this.createMethod(plugin);
|
Method current = this.createMethod(plugin);
|
||||||
if(current == null) continue;
|
if (current == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.preferred.isEmpty())
|
if (this.preferred.isEmpty())
|
||||||
|
{
|
||||||
this.Method = current;
|
this.Method = current;
|
||||||
else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.Attachables.add(current);
|
this.Attachables.add(current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.preferred.isEmpty()) {
|
if (!this.preferred.isEmpty())
|
||||||
do {
|
{
|
||||||
if(hasMethod()) {
|
do
|
||||||
|
{
|
||||||
|
if (hasMethod())
|
||||||
|
{
|
||||||
match = true;
|
match = true;
|
||||||
} else {
|
}
|
||||||
for(Method attached: this.Attachables) {
|
else
|
||||||
if(attached == null) continue;
|
{
|
||||||
|
for (Method attached : this.Attachables)
|
||||||
|
{
|
||||||
|
if (attached == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(hasMethod()) {
|
if (hasMethod())
|
||||||
|
{
|
||||||
match = true;
|
match = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.preferred.isEmpty()) this.Method = attached;
|
if (this.preferred.isEmpty())
|
||||||
|
{
|
||||||
if(count == 0) {
|
|
||||||
if(this.preferred.equalsIgnoreCase(attached.getName()))
|
|
||||||
this.Method = attached;
|
this.Method = attached;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
if (this.preferred.equalsIgnoreCase(attached.getName()))
|
||||||
|
{
|
||||||
|
this.Method = attached;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.Method = attached;
|
this.Method = attached;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
} while(!match);
|
}
|
||||||
|
while (!match);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasMethod();
|
return hasMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Method getMethod() {
|
/**
|
||||||
|
* Grab the existing and initialized (hopefully) Method Class.
|
||||||
|
*
|
||||||
|
* @return <code>Method</code> <em>or</em> <code>Null</code>
|
||||||
|
*/
|
||||||
|
public Method getMethod()
|
||||||
|
{
|
||||||
return Method;
|
return Method;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkDisabled(Plugin method) {
|
/**
|
||||||
if(!hasMethod()) return true;
|
* Verify is a plugin is disabled, only does this if we there is an existing payment
|
||||||
if (Method.isCompatible(method)) Method = null;
|
* method initialized in Register.
|
||||||
|
*
|
||||||
|
* @param method Plugin data from bukkit, Internal Class file.
|
||||||
|
* @return <code>boolean</code>
|
||||||
|
*/
|
||||||
|
public boolean checkDisabled(Plugin method)
|
||||||
|
{
|
||||||
|
if (!hasMethod())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (Method.isCompatible(method))
|
||||||
|
{
|
||||||
|
Method = null;
|
||||||
|
}
|
||||||
return (Method == null);
|
return (Method == null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,120 @@
|
||||||
|
package com.earth2me.essentials.register.payment.methods;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.register.payment.Method;
|
||||||
|
|
||||||
|
import me.ashtheking.currency.Currency;
|
||||||
|
import me.ashtheking.currency.CurrencyList;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MultiCurrency Method implementation.
|
||||||
|
*
|
||||||
|
* @author Acrobot
|
||||||
|
* @copyright (c) 2011
|
||||||
|
* @license AOL license <http://aol.nexua.org>
|
||||||
|
*/
|
||||||
|
public class MCUR implements Method {
|
||||||
|
private Currency currencyList;
|
||||||
|
|
||||||
|
public Object getPlugin() {
|
||||||
|
return this.currencyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "MultiCurrency";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return "0.09";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String format(double amount) {
|
||||||
|
return amount + " Currency";
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBanks() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBank(String bank) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasAccount(String name) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBankAccount(String bank, String name) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MethodAccount getAccount(String name) {
|
||||||
|
return new MCurrencyAccount(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MethodBankAccount getBankAccount(String bank, String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCompatible(Plugin plugin) {
|
||||||
|
return plugin.getDescription().getName().equalsIgnoreCase(getName()) && plugin instanceof Currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlugin(Plugin plugin) {
|
||||||
|
currencyList = (Currency) plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MCurrencyAccount implements MethodAccount{
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public MCurrencyAccount(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double balance() {
|
||||||
|
return CurrencyList.getValue((String) CurrencyList.maxCurrency(name)[0], name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean set(double amount) {
|
||||||
|
CurrencyList.setValue((String) CurrencyList.maxCurrency(name)[0], name, amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean add(double amount) {
|
||||||
|
return CurrencyList.add(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean subtract(double amount) {
|
||||||
|
return CurrencyList.subtract(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean multiply(double amount) {
|
||||||
|
return CurrencyList.multiply(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean divide(double amount) {
|
||||||
|
return CurrencyList.divide(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasEnough(double amount) {
|
||||||
|
return CurrencyList.hasEnough(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasOver(double amount) {
|
||||||
|
return CurrencyList.hasOver(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasUnder(double amount) {
|
||||||
|
return CurrencyList.hasUnder(name, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNegative() {
|
||||||
|
return CurrencyList.isNegative(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean remove() {
|
||||||
|
return CurrencyList.remove(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,142 @@
|
||||||
|
package com.earth2me.essentials.register.payment.methods;
|
||||||
|
|
||||||
|
import com.iCo6.iConomy;
|
||||||
|
import com.iCo6.system.Account;
|
||||||
|
import com.iCo6.system.Accounts;
|
||||||
|
import com.iCo6.system.Holdings;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.register.payment.Method;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* iConomy 6 Implementation of Method
|
||||||
|
*
|
||||||
|
* @author Nijikokun <nijikokun@shortmail.com> (@nijikokun)
|
||||||
|
* @copyright (c) 2011
|
||||||
|
* @license AOL license <http://aol.nexua.org>
|
||||||
|
*/
|
||||||
|
public class iCo6 implements Method {
|
||||||
|
private iConomy iConomy;
|
||||||
|
|
||||||
|
public iConomy getPlugin() {
|
||||||
|
return this.iConomy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "iConomy";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return "6";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String format(double amount) {
|
||||||
|
return this.iConomy.format(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBanks() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBank(String bank) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasAccount(String name) {
|
||||||
|
return (new Accounts()).exists(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBankAccount(String bank, String name) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MethodAccount getAccount(String name) {
|
||||||
|
return new iCoAccount((new Accounts()).get(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
public MethodBankAccount getBankAccount(String bank, String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCompatible(Plugin plugin) {
|
||||||
|
try { Class.forName("com.iCo6.IO"); }
|
||||||
|
catch(Exception e) { return false; }
|
||||||
|
|
||||||
|
return plugin.getDescription().getName().equalsIgnoreCase("iconomy") && plugin.getClass().getName().equals("com.iCo6.iConomy") && plugin instanceof iConomy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlugin(Plugin plugin) {
|
||||||
|
iConomy = (iConomy)plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class iCoAccount implements MethodAccount {
|
||||||
|
private Account account;
|
||||||
|
private Holdings holdings;
|
||||||
|
|
||||||
|
public iCoAccount(Account account) {
|
||||||
|
this.account = account;
|
||||||
|
this.holdings = account.getHoldings();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Account getiCoAccount() {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double balance() {
|
||||||
|
return this.holdings.getBalance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean set(double amount) {
|
||||||
|
if(this.holdings == null) return false;
|
||||||
|
this.holdings.setBalance(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean add(double amount) {
|
||||||
|
if(this.holdings == null) return false;
|
||||||
|
this.holdings.add(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean subtract(double amount) {
|
||||||
|
if(this.holdings == null) return false;
|
||||||
|
this.holdings.subtract(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean multiply(double amount) {
|
||||||
|
if(this.holdings == null) return false;
|
||||||
|
this.holdings.multiply(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean divide(double amount) {
|
||||||
|
if(this.holdings == null) return false;
|
||||||
|
this.holdings.divide(amount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasEnough(double amount) {
|
||||||
|
return this.holdings.hasEnough(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasOver(double amount) {
|
||||||
|
return this.holdings.hasOver(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasUnder(double amount) {
|
||||||
|
return this.holdings.hasUnder(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNegative() {
|
||||||
|
return this.holdings.isNegative();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean remove() {
|
||||||
|
if(this.account == null) return false;
|
||||||
|
this.account.remove();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue