summaryrefslogtreecommitdiffstats
path: root/EssentialsiConomyBridge5/src/com/iConomy/system/Account.java
blob: 0bdb077b4291d52aa8c6dd4cae028d99629012f2 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package com.iConomy.system;

import com.earth2me.essentials.api.Economy;
import com.iConomy.existCheck;
import java.util.ArrayList;


public class Account
{
	private String name;

	public Holdings getHoldings()
	{
		return new Holdings(name, this.name);
	}

	public String getName()
	{
		return name;
	}

	/**
	 * Essentials does not support hidden accounts.
	 * @return false
	 */
	public boolean setHidden(boolean hidden)
	{
		return true;
	}

	//Simply set the account variable type?
	public Account(String name)
	{
		this.name = name;
	}

	public ArrayList<Bank> withBanks()
	{
		ArrayList<Bank> banks = new ArrayList<Bank>();
		if (Economy.accountExist(name + "-bank"))
		{
			Bank bank = new Bank("EcoBanks");
			banks.add(bank);
			return banks;
		}
		return null;
	}

	public ArrayList<Bank> getBankAccounts()
	{
		ArrayList<Bank> banks = new ArrayList<Bank>();
		int breaker = 0;
		Bank bank;
		for (int ctr = 1; breaker != 1; ctr++)
		{
			if (ctr == 1)
			{
				if (Economy.accountExist(name + "-bank"))
				{
					bank = new Bank(name + "-bank");
					banks.add(bank);
				}
				else
				{
					breaker = 1;
				}
			}
			if (Economy.accountExist(name + "-bank" + Integer.toString(ctr)) && ctr != 1)
			{
				bank = new Bank(name + "-bank" + Integer.toString(ctr));
				banks.add(bank);
			}
			else
			{
				breaker = 1;
			}
		}
		return null;
	}

	/**
	 * Essentials does not support hidden accounts.
	 * @return false
	 */
	public boolean isHidden()
	{
		return false;
	}

	public Bank getMainBank()
	{
		Bank bank = null;
		if (!Economy.accountExist(name + "-bank"))
		{
			Economy.newAccount(name + "-bank");
			bank = new Bank(name + "-bank");
			return bank;
		}
		bank = new Bank(name + "-bank");
		return bank;


	}
}