summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/Method.java17
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/Methods.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java23
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java23
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java38
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java27
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java20
8 files changed, 162 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/Method.java b/Essentials/src/com/earth2me/essentials/register/payment/Method.java
index f8bd814ef..ea4477077 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/Method.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/Method.java
@@ -91,6 +91,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>.
*
* @param name Account name
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/Methods.java b/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
index 0fc65534f..34acf9837 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
@@ -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;
}
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java
index 7c83c9b76..bc3893d5e 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java
@@ -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))
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java
index 288e4a5c5..72d1f763e 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java
@@ -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))
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java
index 6248b1b91..53d8ed120 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java
@@ -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);
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java
index fcdb7c43b..1f33df12c 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java
@@ -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));
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java
index 462cb76d5..d56873c3f 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java
@@ -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));
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java
index b74367173..1feee30af 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java
@@ -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));