diff options
author | xeology <xeology@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-05-02 22:54:38 +0000 |
---|---|---|
committer | xeology <xeology@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-05-02 22:54:38 +0000 |
commit | 5b4ecb6cc1606ac875e547305188f6fe3ac651ad (patch) | |
tree | c83735abc84c91b0a033d7654fb5a4161deda6b9 /EssentialsiConomyBridge5/src/com/nijiko/coelho/iConomy/system/Holdings.java | |
parent | 6e6b2df3087673d5b6bda540ed73753bcfb534c4 (diff) | |
download | Essentials-5b4ecb6cc1606ac875e547305188f6fe3ac651ad.tar Essentials-5b4ecb6cc1606ac875e547305188f6fe3ac651ad.tar.gz Essentials-5b4ecb6cc1606ac875e547305188f6fe3ac651ad.tar.lz Essentials-5b4ecb6cc1606ac875e547305188f6fe3ac651ad.tar.xz Essentials-5b4ecb6cc1606ac875e547305188f6fe3ac651ad.zip |
EXPIRIMENTAL Essentials Iconomy Bridge for iConomy 5.0. This has reverse compatability and is tested but unsure of 5.0 API, needs testing but no 5.0 API plugins yet!
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1324 e251c2fe-e539-e718-e476-b85c1f46cddb
Diffstat (limited to 'EssentialsiConomyBridge5/src/com/nijiko/coelho/iConomy/system/Holdings.java')
-rw-r--r-- | EssentialsiConomyBridge5/src/com/nijiko/coelho/iConomy/system/Holdings.java | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/EssentialsiConomyBridge5/src/com/nijiko/coelho/iConomy/system/Holdings.java b/EssentialsiConomyBridge5/src/com/nijiko/coelho/iConomy/system/Holdings.java new file mode 100644 index 000000000..32e86e81f --- /dev/null +++ b/EssentialsiConomyBridge5/src/com/nijiko/coelho/iConomy/system/Holdings.java @@ -0,0 +1,128 @@ +package com.nijiko.coelho.iConomy.system; + +import com.earth2me.essentials.api.Economy; +import com.nijiko.coelho.iConomy.existCheck; + + +public class Holdings +{ + private String name = ""; + private boolean bank = false; + private String bankId = null; + + public Holdings(String name) + { + this.name = name; + } + + public Holdings(String id, String name) + { + this.bankId = id; + this.name = name; + } + + public Holdings(String id, String name, boolean bank) + { + this.bank = bank; + this.bankId = id; + this.name = name; + } + + public double get() + { + if (!existCheck.exist(name)) + { + if (Economy.accountExist(name)) + { + return Economy.getMoney(name); + } + return 0; + } + return Economy.getMoney(name); + } + + public void set(double bal) + { + if (!existCheck.exist(name)) + { + if (Economy.accountExist(name)) + { + Economy.setMoney(name, bal); + } + return; + } + Economy.setMoney(name, bal); + } + + public void add(double money) + { + if (!existCheck.exist(name)) + { + if (Economy.accountExist(name)) + { + Economy.add(name, money); + } + return; + } + Economy.add(name, money); + } + + public void divide(double money) + { + if (!existCheck.exist(name)) + { + if (Economy.accountExist(name)) + { + Economy.divide(name, money); + } + return; + } + Economy.divide(name, money); + } + + public void multiply(double money) + { + if (!existCheck.exist(name)) + { + if (Economy.accountExist(name)) + { + Economy.multiply(name, money); + } + return; + } + Economy.multiply(name, money); + } + + public void subtract(double money) + { + if (!existCheck.exist(name)) + { + if (Economy.accountExist(name)) + { + Economy.subtract(name, money); + } + return; + } + Economy.subtract(name, money); + } + + public void reset() + { + this.set(0); + } + + public boolean hasEnough(double amount) + { + return amount <= this.get(); + } + + public boolean hasOver(double amount) + { + return amount < this.get(); + } + + public boolean isNegative() + { + return this.get() < 0.0; + } +} |