summaryrefslogtreecommitdiffstats
path: root/EssentialsiConomyBridge5/src/com/iConomy/system/Bank.java
blob: ae76c87908e769099a1d75103a37502b08830416 (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
57
58
59
60
61
62
63
64
package com.iConomy.system;

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


public class Bank
{
	private String id = null;
	private String name = null;

	public Bank(String name)
	{
		this.id = name;
		this.name = name;
	}

	//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)
	{
		return new Account(name);
	}

	//Fake remove account
	public void removeAccount(String name)
	{
		if (!existCheck.exist(name))
		{
			if (Economy.accountExist(name))
			{
				Economy.removeAccount(name);
			}
			return;
		}
		Economy.setMoney(name, 0);
	}

	public void createAccount(String account)
	{
		if (!Economy.accountExist(account))
		{
			Economy.newAccount(account);
		}
	}
}