summaryrefslogtreecommitdiffstats
path: root/EssentialsiConomyBridge/src/com/nijiko/coelho/iConomy/system/Bank.java
blob: 54e8e63878bc0a04165cc1c2bc99c731397f89db (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
54
55
56
package com.nijiko.coelho.iConomy.system;

import com.earth2me.essentials.api.Economy;
import com.nijiko.coelho.iConomy.existCheck;


public class Bank
{
	//The fake formatter
	public String format(double amount)
	{
		return Economy.format(amount);
	}

	//Fake currency!
	public String getCurrency()
	{
		return Economy.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 (!Economy.accountExist(account))
			{
				Economy.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 (Economy.accountExist(name))
			{
				Economy.removeAccount(name);
			}
			return;
		}
		Economy.setMoney(name, 0);
	}
}