/TMoney

A minecraft plugin providing support for multiple economies on your server

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

TMoney

Kind of logo

Codacy Badge Build Status
A minecraft plugin providing support for multiple economies on your server

Commands

() - optional argument
[] - required argument
If economy is not specified plugin will use default one (usually Vault)

Balance

/tmoney balance [economy] (player) - Get balance of player in certain economy

Deposit

/tmoney deposit [economy] (player) [amount] - Deposit money on a player's balance in certain economy

Withdraw

/tmoney withdraw [economy] (player) [amount] - Withdraw money from a player's balance in certain economy

Reload

/tmoney reload - Reloads the config

List

/tmoney list - Returns a list of all economies there are

PlaceholderAPI

You need to execute: /papi ecloud download TMoney in order to use placeholders
Just to get balance in certain economy use: %tmoney_<economy>%
To get fixed balance use: %tmoney_<economy>&&<precision>%
To get formatted balance use: %tmoney_<economy>&&formatted% (like 1.32K or 1.55M)

Config

Here is example config (plugins/TMoney/data.json)

{
  "economies": [
    {
      "config": {
        "url": "jdbc:h2:file:/home/minecraft/inst/plugins/TMoney/Economy.db",
        "user": "minecraft",
        "password": "password",
        "prefix": "mc"
      },
      "type": "jdbc",
      "name": "donate"
    }
  ],
  "libsUrl": "https://theseems.ru/tmoney/libs",
  "libs": [
    "org.h2.Driver",
    "org.postgresql.Driver"
  ]
}

Currently supported types of economies in a config:

Type memory means that all balances of players will not be load on server restart
Type jdbc means that all balances of players will be stored on a database (JDBC) and will be load from it on server restart

API

Getting economy

TMoneyAPI.getEconomy("<name>").ifPresent(economy -> {
  // Do some awesome work here
  economy.withdraw(player, amount);
  economy.deposit(player, amount);
  economy.getBalance(player);
});

Getting default economy

Economy economy = TMoneyAPI.getDefault();

Registering own economy

TMoneyAPI.getManager().addEconomy(new Economy() {...});

Removing economy

TMoneyAPI.getManager().removeEconomy("<name>");

Get all economies there are

TMoneyAPI.getManager().getEconomies();