RA-CoinsEconomy

A single-currency Coins economy for Paper 1.21.x with SQLite or MySQL storage, multi-server balance sync over the proxy messaging channel, and PlaceholderAPI support.

Author: RajaAditya Website: rajaaditya.my.id Version: 1.0.0 API: Paper 1.21.x (Java 17+)


Features

One Currency: Coins

  • A simple economy built around a single currency, with a configurable name and symbol (default Coins and ⛁)
  • Players check their balance with /coins
  • A starting balance for new players
  • Extra command aliases come from config.yml, for example /coin

Two Storage Options

  • SQLite for a single server, no setup needed
  • MySQL (HikariCP pool) for several servers sharing one balance

Multi-Server Sync

  • With MySQL, balance changes on one server invalidate the cache on the others through the BungeeCord plugin messaging channel
  • Servers also read fresh data from the database when a player joins, so balances stay consistent
  • Sync is switched off automatically when storage is SQLite

Admin Only From Console

  • Giving, taking, and setting balances, plus reloading, are meant for the console and for other plugins, not for in-game players. Other plugins on the same server can use RA-CoinsEconomy directly to charge players

PlaceholderAPI

  • Show a balance raw, with commas, or abbreviated (1.2K, 1.2M, 1.2B)

Dependencies

PluginRequiredPurpose
PlaceholderAPINo (softdepend)Enables %racoins_*% placeholders

For multi-server sync you need a BungeeCord, Waterfall, or Velocity (compatibility mode) proxy with ip_forward / bungeecord: true enabled on every backend. A message needs at least one online player on the sending server to be delivered, but balances stay correct either way because other servers query the database when a player joins.


Installation

  1. Place RA-CoinsEconomy.jar into your plugins/ folder (HikariCP and the database drivers are bundled)
  2. Restart the server
  3. Edit plugins/RA-CoinsEconomy/config.yml
  4. For several servers, choose database.type: mysql on all of them with the same database

File Structure

text
1
plugins/RA-CoinsEconomy/
├── config.yml       # Database, sync, aliases, currency, messages
└── coins.db         # SQLite file (only when type is sqlite)

Configuration

config.yml

yaml
1
database:
  type: sqlite            # sqlite or mysql
  mysql:
    host: localhost
    port: 3306
    database: ra_coins
    username: root
    password: ""
    pool-size: 10
    connection-timeout-ms: 5000
  sqlite:
    file: coins.db

sync:
  enabled: true           # only effective with mysql

command:
  aliases:
    - coin                # changing aliases needs a full restart

economy:
  starting-balance: 0
  currency-name: "Coins"
  currency-symbol: "⛁"

messages:
  prefix: "&e[Coins] &r"
  balance-self: "&aYour balance: &e{balance} {symbol}"
  balance-other: "&a{player}'s balance: &e{balance} {symbol}"
  give-success: "&aAdded &e{amount} {symbol} &ato {player}"
  take-success: "&aRemoved &e{amount} {symbol} &afrom {player}"
  set-success: "&a{player}'s balance set to &e{amount} {symbol}"
  insufficient-balance: "&c{player} does not have enough balance"
  player-not-found: "&cPlayer '{player}' not found (never joined the server)"
  invalid-amount: "&cInvalid amount, it must be a positive number"

Message placeholders: {balance}, {symbol}, {player}, {amount}.


Commands

CommandDescriptionAccess
/coinsShow your own balanceracoins.use
/coins <player> or /coins balance <player>Show another player's balanceracoins.admin
/coins give <player> <amount>Add to a balanceracoins.admin
/coins take <player> <amount>Subtract from a balance (never below 0)racoins.admin
/coins set <player> <amount>Set a balance directlyracoins.admin
/coins reloadReload the configracoins.reload

Permissions

PermissionDefaultDescription
racoins.usetrueCheck your own balance
racoins.adminfalseManage balances. Only effective from the console
racoins.reloadfalseReload the config. Only effective from the console

PlaceholderAPI

Requires PlaceholderAPI. Identifier: racoins.

PlaceholderExampleDescription
%racoins_balance%1234567Raw balance
%racoins_balance_commas%1,234,567Balance with commas
%racoins_balance_formatted%1.2MAbbreviated balance
%racoins_balance_player_<name>%1234567Raw balance of another player by name

License

Developed by RajaAditya — rajaaditya.my.id