summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-01-16 19:11:41 +0100
committersnowleo <schneeleo@gmail.com>2012-01-16 19:11:41 +0100
commitcd2f819c29a786f693f90b352af99defc2ae69b5 (patch)
treef0a17c09bdeab757e6fdb93c919d8bebd1d8bfa4
parent149ce7d74d3481b120b236ae00831226cbd07380 (diff)
downloadEssentials-cd2f819c29a786f693f90b352af99defc2ae69b5.tar
Essentials-cd2f819c29a786f693f90b352af99defc2ae69b5.tar.gz
Essentials-cd2f819c29a786f693f90b352af99defc2ae69b5.tar.lz
Essentials-cd2f819c29a786f693f90b352af99defc2ae69b5.tar.xz
Essentials-cd2f819c29a786f693f90b352af99defc2ae69b5.zip
Cleanup
-rw-r--r--Essentials/nbproject/pmd.settings1
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/VaultEco.java412
2 files changed, 234 insertions, 179 deletions
diff --git a/Essentials/nbproject/pmd.settings b/Essentials/nbproject/pmd.settings
index cea9eaa13..29baf7ea1 100644
--- a/Essentials/nbproject/pmd.settings
+++ b/Essentials/nbproject/pmd.settings
@@ -1,4 +1,3 @@
DoNotUseThreads
LongVariable
SignatureDeclareThrowsException
-LocalVariableCouldBeFinal
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/VaultEco.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/VaultEco.java
index 64160891c..c7757f66b 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/VaultEco.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/VaultEco.java
@@ -8,265 +8,321 @@ import org.bukkit.plugin.RegisteredServiceProvider;
import com.earth2me.essentials.register.payment.Method;
-public class VaultEco implements Method {
- private Vault vault;
- private Economy economy;
+public class VaultEco implements Method
+{
+ private Vault vault;
+ private Economy economy;
@Override
- public Vault getPlugin() {
- return this.vault;
- }
-
- @Override
- public boolean createAccount(String name, Double amount) {
- if (hasAccount(name)) {
- return false;
- }
-
- return false;
- }
-
+ public Vault getPlugin()
+ {
+ return this.vault;
+ }
+
@Override
- public String getName() {
-
- return this.vault.getDescription().getName().concat(" - Economy: ").concat(economy == null ? "NoEco" : economy.getName());
- }
+ public boolean createAccount(String name, Double amount)
+ {
+ if (hasAccount(name))
+ {
+ return false;
+ }
+
+ return false;
+ }
@Override
- public String getVersion() {
- return this.vault.getDescription().getVersion();
- }
+ public String getName()
+ {
+
+ return this.vault.getDescription().getName().concat(" - Economy: ").concat(economy == null ? "NoEco" : economy.getName());
+ }
@Override
- public int fractionalDigits() {
- return 0;
- }
+ public String getVersion()
+ {
+ return this.vault.getDescription().getVersion();
+ }
@Override
- public String format(double amount) {
- return this.economy.format(amount);
- }
+ public int fractionalDigits()
+ {
+ return 0;
+ }
@Override
- public boolean hasBanks() {
- return this.economy.hasBankSupport();
- }
+ public String format(double amount)
+ {
+ return this.economy.format(amount);
+ }
@Override
- public boolean hasBank(String bank) {
- return this.economy.getBanks().contains(bank);
- }
+ public boolean hasBanks()
+ {
+ return this.economy.hasBankSupport();
+ }
@Override
- public boolean hasAccount(String name) {
- return this.economy.hasAccount(name);
- }
+ public boolean hasBank(String bank)
+ {
+ return this.economy.getBanks().contains(bank);
+ }
@Override
- public boolean hasBankAccount(String bank, String name) {
- return this.economy.isBankOwner(bank, name).transactionSuccess()
- || this.economy.isBankMember(bank, name).transactionSuccess();
- }
+ public boolean hasAccount(String name)
+ {
+ return this.economy.hasAccount(name);
+ }
@Override
- public boolean createAccount(String name) {
- return this.economy.createBank(name, "").transactionSuccess();
- }
+ public boolean hasBankAccount(String bank, String name)
+ {
+ return this.economy.isBankOwner(bank, name).transactionSuccess()
+ || this.economy.isBankMember(bank, name).transactionSuccess();
+ }
- public boolean createAccount(String name, double balance) {
- if(!this.economy.createBank(name, "").transactionSuccess()) {
- return false;
- }
- return this.economy.bankDeposit(name, balance).transactionSuccess();
- }
+ @Override
+ public boolean createAccount(String name)
+ {
+ return this.economy.createBank(name, "").transactionSuccess();
+ }
+
+ public boolean createAccount(String name, double balance)
+ {
+ if (!this.economy.createBank(name, "").transactionSuccess())
+ {
+ return false;
+ }
+ return this.economy.bankDeposit(name, balance).transactionSuccess();
+ }
@Override
- public MethodAccount getAccount(String name) {
- if(!hasAccount(name))
- return null;
+ public MethodAccount getAccount(String name)
+ {
+ if (!hasAccount(name))
+ {
+ return null;
+ }
- return new VaultAccount(name, this.economy);
- }
+ return new VaultAccount(name, this.economy);
+ }
@Override
- public MethodBankAccount getBankAccount(String bank, String name) {
- if(!hasBankAccount(bank, name))
- return null;
+ public MethodBankAccount getBankAccount(String bank, String name)
+ {
+ if (!hasBankAccount(bank, name))
+ {
+ return null;
+ }
- return new VaultBankAccount(bank, economy);
- }
+ return new VaultBankAccount(bank, economy);
+ }
@Override
- public boolean isCompatible(Plugin plugin) {
- RegisteredServiceProvider<Economy> ecoPlugin = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
+ public boolean isCompatible(Plugin plugin)
+ {
+ RegisteredServiceProvider<Economy> ecoPlugin = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
return plugin instanceof Vault && ecoPlugin != null && !ecoPlugin.getProvider().getName().equals("Essentials Economy");
- }
+ }
@Override
- public void setPlugin(Plugin plugin) {
- this.vault = (Vault) plugin;
- RegisteredServiceProvider<Economy> economyProvider = this.vault.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
- if (economyProvider != null) {
- this.economy = economyProvider.getProvider();
- }
- }
-
- public class VaultAccount implements MethodAccount {
- private final String name;
- private final Economy economy;
-
- public VaultAccount(String name, Economy economy) {
- this.name = name;
- this.economy = economy;
- }
+ public void setPlugin(Plugin plugin)
+ {
+ this.vault = (Vault)plugin;
+ RegisteredServiceProvider<Economy> economyProvider = this.vault.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
+ if (economyProvider != null)
+ {
+ this.economy = economyProvider.getProvider();
+ }
+ }
+
+
+ public class VaultAccount implements MethodAccount
+ {
+ private final String name;
+ private final Economy economy;
+
+ public VaultAccount(String name, Economy economy)
+ {
+ this.name = name;
+ this.economy = economy;
+ }
@Override
- public double balance() {
- return this.economy.getBalance(this.name);
- }
+ public double balance()
+ {
+ return this.economy.getBalance(this.name);
+ }
@Override
- public boolean set(double amount) {
- if(!this.economy.withdrawPlayer(this.name, this.balance()).transactionSuccess()) {
- return false;
- }
- if(amount == 0) {
- return true;
- }
- return this.economy.depositPlayer(this.name, amount).transactionSuccess();
- }
+ public boolean set(double amount)
+ {
+ if (!this.economy.withdrawPlayer(this.name, this.balance()).transactionSuccess())
+ {
+ return false;
+ }
+ if (amount == 0)
+ {
+ return true;
+ }
+ return this.economy.depositPlayer(this.name, amount).transactionSuccess();
+ }
@Override
- public boolean add(double amount) {
- return this.economy.depositPlayer(this.name, amount).transactionSuccess();
- }
+ public boolean add(double amount)
+ {
+ return this.economy.depositPlayer(this.name, amount).transactionSuccess();
+ }
@Override
- public boolean subtract(double amount) {
- return this.economy.withdrawPlayer(this.name, amount).transactionSuccess();
- }
+ public boolean subtract(double amount)
+ {
+ return this.economy.withdrawPlayer(this.name, amount).transactionSuccess();
+ }
@Override
- public boolean multiply(double amount) {
- double balance = this.balance();
- return this.set(balance * amount);
- }
+ public boolean multiply(double amount)
+ {
+ double balance = this.balance();
+ return this.set(balance * amount);
+ }
@Override
- public boolean divide(double amount) {
- double balance = this.balance();
- return this.set(balance / amount);
- }
+ public boolean divide(double amount)
+ {
+ double balance = this.balance();
+ return this.set(balance / amount);
+ }
@Override
- public boolean hasEnough(double amount) {
- return (this.balance() >= amount);
- }
+ public boolean hasEnough(double amount)
+ {
+ return (this.balance() >= amount);
+ }
@Override
- public boolean hasOver(double amount) {
- return (this.balance() > amount);
- }
+ public boolean hasOver(double amount)
+ {
+ return (this.balance() > amount);
+ }
@Override
- public boolean hasUnder(double amount) {
- return (this.balance() < amount);
- }
+ public boolean hasUnder(double amount)
+ {
+ return (this.balance() < amount);
+ }
@Override
- public boolean isNegative() {
- return (this.balance() < 0);
- }
+ public boolean isNegative()
+ {
+ return (this.balance() < 0);
+ }
@Override
- public boolean remove() {
- return this.set(0.0);
- }
- }
+ public boolean remove()
+ {
+ return this.set(0.0);
+ }
+ }
- public class VaultBankAccount implements MethodBankAccount {
- private final String bank;
- private final Economy economy;
+ public class VaultBankAccount implements MethodBankAccount
+ {
+ private final String bank;
+ private final Economy economy;
- public VaultBankAccount(String bank, Economy economy) {
- this.bank = bank;
- this.economy = economy;
- }
+ public VaultBankAccount(String bank, Economy economy)
+ {
+ this.bank = bank;
+ this.economy = economy;
+ }
@Override
- public String getBankName() {
- return this.bank;
- }
+ public String getBankName()
+ {
+ return this.bank;
+ }
@Override
- public int getBankId() {
- return -1;
- }
+ public int getBankId()
+ {
+ return -1;
+ }
@Override
- public double balance() {
- return this.economy.bankBalance(this.bank).balance;
- }
+ public double balance()
+ {
+ return this.economy.bankBalance(this.bank).balance;
+ }
@Override
- public boolean set(double amount) {
- if(!this.economy.bankWithdraw(this.bank, this.balance()).transactionSuccess()) {
- return false;
- }
- if(amount == 0) {
- return true;
- }
- return this.economy.bankDeposit(this.bank, amount).transactionSuccess();
- }
+ public boolean set(double amount)
+ {
+ if (!this.economy.bankWithdraw(this.bank, this.balance()).transactionSuccess())
+ {
+ return false;
+ }
+ if (amount == 0)
+ {
+ return true;
+ }
+ return this.economy.bankDeposit(this.bank, amount).transactionSuccess();
+ }
@Override
- public boolean add(double amount) {
- return this.economy.bankDeposit(this.bank, amount).transactionSuccess();
- }
+ public boolean add(double amount)
+ {
+ return this.economy.bankDeposit(this.bank, amount).transactionSuccess();
+ }
@Override
- public boolean subtract(double amount) {
- return this.economy.bankWithdraw(this.bank, amount).transactionSuccess();
- }
+ public boolean subtract(double amount)
+ {
+ return this.economy.bankWithdraw(this.bank, amount).transactionSuccess();
+ }
@Override
- public boolean multiply(double amount) {
- double balance = this.balance();
- return this.set(balance * amount);
- }
+ public boolean multiply(double amount)
+ {
+ double balance = this.balance();
+ return this.set(balance * amount);
+ }
@Override
- public boolean divide(double amount) {
- double balance = this.balance();
- return this.set(balance / amount);
- }
+ public boolean divide(double amount)
+ {
+ double balance = this.balance();
+ return this.set(balance / amount);
+ }
@Override
- public boolean hasEnough(double amount) {
- return (this.balance() >= amount);
- }
+ public boolean hasEnough(double amount)
+ {
+ return (this.balance() >= amount);
+ }
@Override
- public boolean hasOver(double amount) {
- return (this.balance() > amount);
- }
+ public boolean hasOver(double amount)
+ {
+ return (this.balance() > amount);
+ }
@Override
- public boolean hasUnder(double amount) {
- return (this.balance() < amount);
- }
+ public boolean hasUnder(double amount)
+ {
+ return (this.balance() < amount);
+ }
@Override
- public boolean isNegative() {
- return (this.balance() < 0);
- }
+ public boolean isNegative()
+ {
+ return (this.balance() < 0);
+ }
@Override
- public boolean remove() {
- return this.set(0.0);
- }
-
- }
+ public boolean remove()
+ {
+ return this.set(0.0);
+ }
+ }
} \ No newline at end of file