diff --git a/src/net/milkbowl/vault/VaultEco.java b/src/net/milkbowl/vault/VaultEco.java index 693979e..b7f7e6f 100644 --- a/src/net/milkbowl/vault/VaultEco.java +++ b/src/net/milkbowl/vault/VaultEco.java @@ -22,7 +22,7 @@ public class VaultEco implements Method { if (hasAccount(name)) { return false; } - + return false; } diff --git a/src/net/milkbowl/vault/economy/Economy.java b/src/net/milkbowl/vault/economy/Economy.java index 73a538b..dace53b 100644 --- a/src/net/milkbowl/vault/economy/Economy.java +++ b/src/net/milkbowl/vault/economy/Economy.java @@ -154,4 +154,10 @@ public interface Economy { * @return the List of Banks */ public List getBanks(); + + /** + * Attempts to create a player account for the given player + * @return if the account creation was successful + */ + public boolean createPlayerAccount(String playerName); } \ No newline at end of file diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_3co.java b/src/net/milkbowl/vault/economy/plugins/Economy_3co.java index 8ab76b8..97f422d 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_3co.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_3co.java @@ -29,6 +29,8 @@ import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.EconomyResponse; import net.milkbowl.vault.economy.EconomyResponse.ResponseType; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Type; import org.bukkit.event.server.PluginDisableEvent; @@ -241,4 +243,14 @@ public class Economy_3co implements Economy { public boolean hasAccount(String playerName) { return economy.hasAccount(plugin.getServer().getPlayer(playerName)); } + + @Override + public boolean createPlayerAccount(String playerName) { + Player p = Bukkit.getPlayer(playerName); + if (p == null) { + return false; + } + economy.createAccount(p, 0); + return true; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java index e8d6e7e..ba42563 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java @@ -290,4 +290,12 @@ public class Economy_BOSE6 implements Economy { public boolean hasAccount(String playerName) { return economy.playerRegistered(playerName, false); } + + @Override + public boolean createPlayerAccount(String playerName) { + if (economy.playerRegistered(playerName, false)) { + return false; + } + return economy.registerPlayer(playerName); + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java index 06f552c..e8587c2 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java @@ -291,4 +291,12 @@ public class Economy_BOSE7 implements Economy { public boolean hasAccount(String playerName) { return economy.playerRegistered(playerName, false); } + + @Override + public boolean createPlayerAccount(String playerName) { + if (economy.playerRegistered(playerName, false)) { + return false; + } + return economy.registerPlayer(playerName); + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java b/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java index f2baea5..361aae4 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java @@ -206,4 +206,13 @@ public class Economy_CurrencyCore implements Economy { public boolean hasAccount(String playerName) { return this.currency.getAccountManager().getAccount(playerName) != null; } + + @Override + public boolean createPlayerAccount(String playerName) { + if (this.currency.getAccountManager().getAccount(playerName) != null) { + return false; + } + this.currency.getAccountManager().createAccount(playerName); + return true; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java b/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java index b044d9c..5f1d074 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java @@ -206,4 +206,9 @@ public class Economy_EconXP implements Economy { public boolean hasAccount(String playerName) { return econ.getPlayer(playerName) != null; } + + @Override + public boolean createPlayerAccount(String playerName) { + return false; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java b/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java index c29c465..a2657a7 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java @@ -95,7 +95,8 @@ public class Economy_Essentials implements Economy { return balance; } - private boolean createPlayerAccount(String playerName) { + @Override + public boolean createPlayerAccount(String playerName) { try { com.earth2me.essentials.api.Economy.add(playerName, 0); return true; diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java b/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java index 862661c..67dec30 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java @@ -175,4 +175,13 @@ public class Economy_MineConomy implements Economy { public boolean hasAccount(String playerName) { return Accounting.containsKey(playerName, MineConomy.accounts); } + + @Override + public boolean createPlayerAccount(String playerName) { + if (hasAccount(playerName)) { + return false; + } + Accounting.setBalance(playerName, 0, MineConomy.accounts); + return true; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java b/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java index 741b8ae..9433cc3 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java @@ -246,4 +246,9 @@ public class Economy_MultiCurrency implements Economy { public boolean hasAccount(String playerName) { return true; } + + @Override + public boolean createPlayerAccount(String playerName) { + return false; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java b/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java index 79c2e52..a5747b3 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java @@ -182,4 +182,13 @@ public class Economy_eWallet implements Economy { public boolean hasAccount(String playerName) { return econ.hasAccount(playerName); } + + @Override + public boolean createPlayerAccount(String playerName) { + if (hasAccount(playerName)) { + return false; + } + econ.createAccount(playerName, 0); + return true; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java index 22281f0..9970137 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java @@ -252,4 +252,13 @@ public class Economy_iConomy4 implements Economy { public boolean hasAccount(String playerName) { return iConomy.getBank().hasAccount(playerName); } + + @Override + public boolean createPlayerAccount(String playerName) { + if (hasAccount(playerName)) { + return false; + } + iConomy.getBank().addAccount(playerName); + return true; + } } \ No newline at end of file diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java index 870e6fe..42fe8be 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java @@ -215,4 +215,13 @@ public class Economy_iConomy5 implements Economy { public boolean hasAccount(String playerName) { return iConomy.hasAccount(playerName); } + + @Override + public boolean createPlayerAccount(String playerName) { + if (hasAccount(playerName)) { + return false; + } + iConomy.getAccount(playerName); + return true; + } } \ No newline at end of file diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java index db81f0f..e8b396e 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java @@ -208,4 +208,12 @@ public class Economy_iConomy6 implements Economy { public boolean hasAccount(String playerName) { return accounts.exists(playerName); } + + @Override + public boolean createPlayerAccount(String playerName) { + if (hasAccount(playerName)) { + return false; + } + return accounts.create(playerName); + } }