From d7ab974199006815183a005c987598fdeaac735d Mon Sep 17 00:00:00 2001 From: LRFLEW Date: Thu, 21 Jun 2012 17:11:16 -0500 Subject: [PATCH 1/3] Added fractionalDigits() --- src/net/milkbowl/vault/economy/Economy.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/net/milkbowl/vault/economy/Economy.java b/src/net/milkbowl/vault/economy/Economy.java index 537c1ac..d771aff 100644 --- a/src/net/milkbowl/vault/economy/Economy.java +++ b/src/net/milkbowl/vault/economy/Economy.java @@ -42,6 +42,14 @@ public interface Economy { */ public boolean hasBankSupport(); + /** + * Some economy plugins round off after a certain number of digits. + * This function returns the number of digits the plugin keeps + * or -1 if no rounding occurs. + * @return number of digits after the decimal point kept + */ + public int fractionalDigits(); + /** * Format amount into a human readable String This provides translation into * economy specific formatting to improve consistency between plugins. From e9f86167c85f700f83c2b19e84c18c42cffc07c3 Mon Sep 17 00:00:00 2001 From: Lewis Fox Date: Fri, 22 Jun 2012 23:19:15 -0500 Subject: [PATCH 2/3] Some fractionalDigits() copied my work on Register. I will be verifying these. --- .gitignore | 5 +++++ src/net/milkbowl/vault/economy/plugins/Economy_3co.java | 5 +++++ src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java | 5 +++++ src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java | 5 +++++ .../milkbowl/vault/economy/plugins/Economy_Craftconomy.java | 5 +++++ .../milkbowl/vault/economy/plugins/Economy_Essentials.java | 5 +++++ .../vault/economy/plugins/Economy_MultiCurrency.java | 5 +++++ src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java | 5 +++++ src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java | 5 +++++ src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java | 5 +++++ 10 files changed, 50 insertions(+) diff --git a/.gitignore b/.gitignore index 8fbf937..d201e90 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,8 @@ javadoc Vault.jar /Vault.iml /target + +#added by LRFLEW +#feel free to remove +bin +*.DS_Store \ 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 7f2af81..ce3bc71 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_3co.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_3co.java @@ -255,4 +255,9 @@ public class Economy_3co implements Economy { economy.createAccount(p, 0); return true; } + + @Override + public int fractionalDigits() { + return 0; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java index 8beea1c..b0ef63f 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE6.java @@ -300,4 +300,9 @@ public class Economy_BOSE6 implements Economy { } return economy.registerPlayer(playerName); } + + @Override + public int fractionalDigits() { + return 0; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java index 283345c..ab90078 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_BOSE7.java @@ -270,4 +270,9 @@ public class Economy_BOSE7 implements Economy { } return economy.registerPlayer(playerName); } + + @Override + public int fractionalDigits() { + return economy.getFractionalDigits(); + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java b/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java index d0d3a25..f23de07 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java @@ -299,4 +299,9 @@ public class Economy_Craftconomy implements Economy { AccountHandler.getAccount(playerName); return true; } + + @Override + public int fractionalDigits() { + return 2; + } } \ No newline at end of file diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java b/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java index 2229eb5..ec6f636 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_Essentials.java @@ -280,4 +280,9 @@ public class Economy_Essentials implements Economy { public boolean hasAccount(String playerName) { return com.earth2me.essentials.api.Economy.playerExists(playerName); } + + @Override + public int fractionalDigits() { + return -1; + } } \ No newline at end of file diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java b/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java index 5db7727..86b64d3 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_MultiCurrency.java @@ -256,4 +256,9 @@ public class Economy_MultiCurrency implements Economy { public boolean createPlayerAccount(String playerName) { return false; } + + @Override + public int fractionalDigits() { + return -1; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java index 2b1d18e..5df59d3 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy4.java @@ -260,4 +260,9 @@ public class Economy_iConomy4 implements Economy { iConomy.getBank().addAccount(playerName); return true; } + + @Override + public int fractionalDigits() { + return 2; + } } \ 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 3ed17a7..4ab721e 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy5.java @@ -226,4 +226,9 @@ public class Economy_iConomy5 implements Economy { iConomy.getAccount(playerName); return true; } + + @Override + public int fractionalDigits() { + return 2; + } } \ 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 4eb2d57..3724a8f 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_iConomy6.java @@ -252,4 +252,9 @@ public class Economy_iConomy6 implements Economy { } return accounts.create(playerName); } + + @Override + public int fractionalDigits() { + return -1; + } } From 4a987eb250628f40ec65849f62e06350d0ea6033 Mon Sep 17 00:00:00 2001 From: Lewis Fox Date: Sun, 24 Jun 2012 20:28:01 -0500 Subject: [PATCH 3/3] Finished adding fractionalDigits() all of the fractionalDigits() have now been tested personally :) --- src/net/milkbowl/vault/economy/plugins/Economy_AEco.java | 5 +++++ .../milkbowl/vault/economy/plugins/Economy_Craftconomy.java | 2 +- .../milkbowl/vault/economy/plugins/Economy_CurrencyCore.java | 5 +++++ src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java | 5 +++++ src/net/milkbowl/vault/economy/plugins/Economy_McMoney.java | 5 +++++ .../milkbowl/vault/economy/plugins/Economy_MineConomy.java | 5 +++++ src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java | 5 +++++ 7 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_AEco.java b/src/net/milkbowl/vault/economy/plugins/Economy_AEco.java index c987539..def8bdf 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_AEco.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_AEco.java @@ -230,4 +230,9 @@ public class Economy_AEco implements Economy { } return false; } + + @Override + public int fractionalDigits() { + return 0; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java b/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java index f23de07..d171326 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_Craftconomy.java @@ -302,6 +302,6 @@ public class Economy_Craftconomy implements Economy { @Override public int fractionalDigits() { - return 2; + return -1; } } \ No newline at end of file diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java b/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java index ba6587d..6fa597d 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_CurrencyCore.java @@ -263,4 +263,9 @@ public class Economy_CurrencyCore implements Economy { this.currency.getAccountManager().createAccount(playerName); return true; } + + @Override + public int fractionalDigits() { + return -1; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java b/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java index 5ad91a7..f251c85 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_EconXP.java @@ -237,4 +237,9 @@ public class Economy_EconXP implements Economy { public boolean createPlayerAccount(String playerName) { return false; } + + @Override + public int fractionalDigits() { + return 0; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_McMoney.java b/src/net/milkbowl/vault/economy/plugins/Economy_McMoney.java index 4d94de0..1064a46 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_McMoney.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_McMoney.java @@ -209,4 +209,9 @@ public class Economy_McMoney implements Economy { } return false; } + + @Override + public int fractionalDigits() { + return -1; + } } diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java b/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java index f1acd85..8d69c92 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_MineConomy.java @@ -233,4 +233,9 @@ public class Economy_MineConomy implements Economy { return false; } } + + @Override + public int fractionalDigits() { + return 2; + } } \ No newline at end of file diff --git a/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java b/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java index d55074a..1ef83d7 100644 --- a/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java +++ b/src/net/milkbowl/vault/economy/plugins/Economy_eWallet.java @@ -215,4 +215,9 @@ public class Economy_eWallet implements Economy { econ.createAccount(playerName, 0); return true; } + + @Override + public int fractionalDigits() { + return 0; + } }