Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/by1337/bvault


https://github.com/by1337/bvault

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# BVault

BVault is a multi-currency economy plugin for Minecraft.

## Description

The plugin provides its own API for interacting with the economy and implements [VaultAPI](https://github.com/MilkBowl/VaultAPI).

### Key Features:

- Support for multiple currencies.
- Implementation of the "bank" concept.
- Compatibility with VaultAPI.
- Ability to create banks dynamically.

### Banks

The plugin introduces a new concept — "bank." A bank is an indicator of the current currency.

- By default, the 'vault' bank is used. It is applied when implementing VaultAPI and is also used in the `getBalance`, `withdraw`, and `deposit` methods if a specific bank is not specified.
- A player's balance in one bank is not related to their balance in another bank.
- There can be an unlimited number of banks.
- Banks can be created dynamically. When calling `BEconomy.deposit("new bank", uuid)`, a new bank is created transparently to the user.

## Example Usage

```java
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.by1337.bvault.api.BEconomy;

RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(BEconomy.class);
BEconomy economy = Objects.requireNonNull(rsp, "Economy provider not found!").getProvider();

Player player = Bukkit.getPlayer("_By1337_");

// Getting the player's balance
economy.getBalance(player.getUniqueId()).whenComplete((balance, t) -> {
System.out.println("The player has " + balance + " coins");
});

// Or
Double balance = economy.getBalance(player.getUniqueId()).join();

// Withdrawing funds
economy.withdraw(player.getUniqueId(), 100D).whenComplete((newBalance, t) -> {
System.out.println("Transaction completed!");
});

// Depositing funds
economy.deposit(player.getUniqueId(), 100D).whenComplete((newBalance, t) -> {
System.out.println("Transaction completed!");
});

// Getting the player's balance in another currency
Double balance1 = economy.getBalance("donat_points", player.getUniqueId()).join();
```

## Dependencies

To use the plugin, add the following repository and dependency to your `pom.xml`:

```xml



by1337-repo
https://repo.by1337.space/repository/maven-releases/



org.by1337.bvault.api
BVaultApi
1.1
provided

```

## License

This project is licensed under the [MIT License](LICENSE).