mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-08-26 15:32:50 +02:00
Register 1.5
This commit is contained in:
parent
0645d58594
commit
55fc8bdd57
|
@ -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>.
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue
Block a user