summaryrefslogtreecommitdiffstats
path: root/EssentialsiConomyBridge/src/com/nijiko/coelho/iConomy/system/Bank.java
blob: b70803dda7d762be8bbc2ad698aa18239a31c8c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.nijiko.coelho.iConomy.system;

import com.earth2me.essentials.EcoAPI;
import com.nijiko.coelho.iConomy.existCheck;


public class Bank {

    //The fake formatter

	public String format(double amount) {
		return EcoAPI.format(amount);
    }

	//Fake currency!

    public String getCurrency() {
        return EcoAPI.getCurrency();
    }

	//Fake "does player have an account?" but essentials eco doesnt need to make one, so TRUE, unless its an NPC.

	public boolean hasAccount(String account) {
		if (!existCheck.exist(account)){
			if (!EcoAPI.accountExist(account)){
				EcoAPI.newAccount(account);
			}			
		}
		return true;
	}
	
	//simply switches the name to an account type?
	
	public Account getAccount(String name){
		Account Account=null;
		Account=new Account(name);
		hasAccount(name);
		return Account;
	}
	
	//Fake remove account
	
	public void removeAccount(String name){
		if (!existCheck.exist(name)){
			if (EcoAPI.accountExist(name)){
				EcoAPI.removeAccount(name);
			}
			return;
		}
		EcoAPI.setMoney(name, 0);
	}
	
}