Register 1.5

This commit is contained in:
snowleo 2011-10-04 23:06:06 +02:00
parent 0645d58594
commit 55fc8bdd57
8 changed files with 162 additions and 1 deletions

View File

@ -90,6 +90,23 @@ public interface Method
*/
public boolean hasBankAccount(String bank, String name);
/**
* Forces an account creation
*
* @param name Account name
* @return <code>boolean</code>
*/
public boolean createAccount(String name);
/**
* Forces an account creation
*
* @param name Account name
* @param balance Initial account balance
* @return <code>boolean</code>
*/
public boolean createAccount(String name, Double balance);
/**
* Returns a <code>MethodAccount</code> class for an account <code>name</code>.
*

View File

@ -2,6 +2,7 @@ package com.earth2me.essentials.register.payment;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
@ -168,7 +169,7 @@ public class Methods
}
plugin = manager.getPlugin(name);
if (plugin == null)
if (plugin == null || !plugin.isEnabled())
{
continue;
}

View File

@ -71,6 +71,29 @@ public class BOSE6 implements Method
|| this.BOSEconomy.isBankMember(bank, name);
}
public boolean createAccount(String name)
{
if (hasAccount(name))
{
return false;
}
this.BOSEconomy.registerPlayer(name);
return true;
}
public boolean createAccount(String name, Double balance)
{
if (hasAccount(name))
{
return false;
}
this.BOSEconomy.registerPlayer(name);
this.BOSEconomy.setPlayerMoney(name, balance, false);
return true;
}
public MethodAccount getAccount(String name)
{
if (!hasAccount(name))

View File

@ -70,6 +70,29 @@ public class BOSE7 implements Method
return this.BOSEconomy.isBankOwner(bank, name) || this.BOSEconomy.isBankMember(bank, name);
}
public boolean createAccount(String name)
{
if (hasAccount(name))
{
return false;
}
this.BOSEconomy.registerPlayer(name);
return true;
}
public boolean createAccount(String name, Double balance)
{
if (hasAccount(name))
{
return false;
}
this.BOSEconomy.registerPlayer(name);
this.BOSEconomy.setPlayerMoney(name, balance, false);
return true;
}
public MethodAccount getAccount(String name)
{
if (!hasAccount(name))

View File

@ -64,6 +64,18 @@ public class MCUR implements Method
return false;
}
public boolean createAccount(String name)
{
CurrencyList.setValue((String)CurrencyList.maxCurrency(name)[0], name, 0);
return true;
}
public boolean createAccount(String name, Double balance)
{
CurrencyList.setValue((String)CurrencyList.maxCurrency(name)[0], name, balance);
return true;
}
public MethodAccount getAccount(String name)
{
return new MCurrencyAccount(name);

View File

@ -64,6 +64,44 @@ public class iCo4 implements Method
return false;
}
public boolean createAccount(String name)
{
if (hasAccount(name))
{
return false;
}
try
{
com.nijiko.coelho.iConomy.iConomy.getBank().addAccount(name);
}
catch (Exception E)
{
return false;
}
return true;
}
public boolean createAccount(String name, Double balance)
{
if (hasAccount(name))
{
return false;
}
try
{
com.nijiko.coelho.iConomy.iConomy.getBank().addAccount(name, balance);
}
catch (Exception E)
{
return false;
}
return true;
}
public MethodAccount getAccount(String name)
{
return new iCoAccount(com.nijiko.coelho.iConomy.iConomy.getBank().getAccount(name));

View File

@ -67,6 +67,33 @@ public class iCo5 implements Method
return (hasBank(bank)) && com.iConomy.iConomy.getBank(bank).hasAccount(name);
}
public boolean createAccount(String name)
{
if (hasAccount(name))
{
return false;
}
return com.iConomy.iConomy.Accounts.create(name);
}
public boolean createAccount(String name, Double balance)
{
if (hasAccount(name))
{
return false;
}
if (!com.iConomy.iConomy.Accounts.create(name))
{
return false;
}
getAccount(name).set(balance);
return true;
}
public MethodAccount getAccount(String name)
{
return new iCoAccount(com.iConomy.iConomy.getAccount(name));

View File

@ -66,6 +66,26 @@ public class iCo6 implements Method
return false;
}
public boolean createAccount(String name)
{
if (hasAccount(name))
{
return false;
}
return (new Accounts()).create(name);
}
public boolean createAccount(String name, Double balance)
{
if (hasAccount(name))
{
return false;
}
return (new Accounts()).create(name, balance);
}
public MethodAccount getAccount(String name)
{
return new iCoAccount((new Accounts()).get(name));