You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.0 KiB
38 lines
1.0 KiB
3 years ago
|
package org.poopki.duckdns.user_db;
|
||
|
|
||
|
import org.bukkit.entity.Player;
|
||
|
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
import java.util.UUID;
|
||
|
|
||
|
public class AccountArray {
|
||
|
public static Map<UUID, Account> m_AccountArray = new HashMap<UUID, Account>();
|
||
|
|
||
|
public void transfer(UUID Src, UUID Des, int Amount){
|
||
|
Account m_Src = m_AccountArray.get(Src);
|
||
|
Account m_Des = m_AccountArray.get(Des);
|
||
|
|
||
|
if(m_Src.getBalance()-Amount>0){
|
||
|
m_Src.withdraw(Amount);
|
||
|
m_Des.credit(Amount);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public int getAccountInfo(UUID uuid) {
|
||
|
Account m_Account = m_AccountArray.get(uuid);
|
||
|
return m_Account.getBalance();
|
||
|
}
|
||
|
|
||
|
public Account putAccountInfo(UUID uuid) {
|
||
|
m_AccountArray.put(uuid, new Account());
|
||
|
Account m_Account = m_AccountArray.get(uuid);
|
||
|
return m_Account;
|
||
|
}
|
||
|
public Account putAccountInfo(UUID uuid, int Amount) {
|
||
|
m_AccountArray.put(uuid, new Account(Amount));
|
||
|
Account m_Account = m_AccountArray.get(uuid);
|
||
|
return m_Account;
|
||
|
}
|
||
|
}
|