# SharedBank

These functions are found in **RoyaleEconomy.apiHandler.sharedBank:**

You can open all menus from a bank using their specific functions:\
&#x20;     \- openSharedBankMainMenu(Player p)\
&#x20;     \- openSharedBankDepositMenu(Player p)\
&#x20;     \- openSharedBankWithdrawMenu(Player p)\
&#x20;     \- openSharedBankUpgradeMenu(Player p)

You can log transactions that don't even exist, adding a transaction log is not the same with adding money. For logging transactions you need to use **addTransactionLog(String bankID, String byWho, String symbol, double amount).**\
&#x20;          \- bankID » the bank id\
&#x20;          \- byWho » coloured name that will be displayed as transaction maker ("by %byWho%).\
&#x20;          \- symbol » + or - anything else will give an error\
&#x20;          \- amount » the amount of coins in this transaction

```
String playerUUID = e.getPlayer().getUniqueId().toString();
String bankID = RoyaleEconomy.apiHandler.sharedBank.getSharedBankID(playerUUID);
RoyaleEconomy.apiHandler.bank.addTransactionLog(bankID, "&8Server", "+", 1500);
```

You can also get the current bank upgrade the player has and set it with functions **getSharedBankUpgrade(String playerUUID)** and **setSharedBankUpgrade(int upgrade, String playerUUID)**.

```
String playerUUID = e.getPlayer().getUniqueId().toString();
String bankID = RoyaleEconomy.apiHandler.sharedBank.getSharedBankID(playerUUID);
int currentUpgrade = RoyaleEconomy.apiHandler.bank.getSharedBankUpgrade(bankID);
RoyaleEconomy.apiHandler.bank.setSharedBankUpgrade(currentUpgrade+1, bankID);
```

**boolean isSharedBankOwner(Player p)** » Verifies if a player is owner of any shared bank.

**boolean createSharedBank(Player p)** » Creates a shared bank for a player, return true if the bank was successfully created and false if the bank couldn't be created (example, player already has a shared bank).

**boolean deleteSharedBank(Player p)** » Deletes a shared bank for a player, returns true if the bank was successfully deleted and false if the bank couldn't be deleted (example, it doesn't exist).

**boolean deleteSharedBank(String bankID)** » You can delete banks based on ids too. Same returns as the function above.

**boolean addMemberToSharedBank(Player toAdd, String bankID)** » Adds a member to a shared bank. Returns false if the player couldn't be added. (example, player already has a bank, player doesn't exist, the bank doesn't exist).

**boolean removeMemberFromSharedBank(Player toRemove, String bankID)** » Removes a member from a shared bank. Returns false if the player couldn't be removed. (example, player is not part of the bank).

**ArrayList\<String> getSharedBankMembers(String bankID, boolean owner)** » Returns the list of members of a bank as uuids parsed as strings. If owner is true, the first member in the list will be the uuid of the owner.

**boolean transferOwnerShip(String oldOwnerUUID, String newOwnerUUID)** » Changes the owner of a bank. The new uuid must be from the members' list. Returns false if the transfer fails.

**ArrayList\<String> getTransactionLog(String bankID)** » Returns the list of transactions.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://d-ghinea.gitbook.io/royaleeconomy/api/sharedbank.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
