RA-StoreSync
Author: RajaAditya Website: rajaaditya.my.id Version: 1.0.0 API: Paper 1.21.x (Java 17+)
Features
Website Top-Ups to In-Game Coins
- Your coin store website writes orders into a
store_orderstable - This plugin checks that table on a timer and delivers the coins in game
- Paid orders run
coins give <player> <amount>, refunded orders runcoins take <player> <amount> - Other statuses (pending, failed, cancelled, expired) never trigger anything
Reliable Delivery
- Once a command has run successfully, the order is marked
processed = true - If the command fails (for example RA-CoinsEconomy had crashed), the order stays unprocessed and is tried again on the next poll
- The plugin never writes the balance table directly. It goes through RA-CoinsEconomy's own command, so validation, caching, and multi-server sync stay on one tested path
Flexible Commands
- The give and take commands are configurable, so another economy plugin can be used later if its format differs
Dependencies
| Component | Required | Purpose |
|---|---|---|
| RA-CoinsEconomy | Yes (hard dependency) | Provides the /coins command. It must be installed on the same server |
| MySQL | Yes | The same database as the website and RA-CoinsEconomy |
The plugin refuses to enable if RA-CoinsEconomy is not on the same server. The lobby is a good place, as long as the lobby also has RA-CoinsEconomy.
Installation
- Place
RA-StoreSync.jarinto theplugins/folder of the server that has RA-CoinsEconomy - Restart the server to generate
config.yml - Put the same database details as the website and RA-CoinsEconomy into
config.yml - Restart and run
/storesync status
File Structure
text
1
plugins/RA-StoreSync/
└── config.yml # Database, polling interval, commands
Configuration
config.yml
yaml
1
database:
host: localhost
port: 3306
database: ra_coins # same as the website DATABASE_URL and RA-CoinsEconomy
username: your_user
password: "YOUR_PASSWORD"
pool-size: 5
connection-timeout-ms: 5000
polling:
interval-seconds: 10
commands:
give-command: "coins give {player} {amount}"
take-command: "coins take {player} {amount}"
messages:
console-prefix: "[RA-StoreSync] "
Command placeholders: {player} and {amount}.
The database connection and polling interval need a full restart to change. /storesync reload only refreshes the values kept in memory.
How Polling Works
Every polling.interval-seconds seconds the plugin looks for orders it has not handled yet:
sql
1
SELECT * FROM store_orders WHERE status = 'PAID' AND processed = false;
SELECT * FROM store_orders WHERE status = 'REFUNDED' AND processed = false;
Commands
| Command | Description | Access |
|---|---|---|
/storesync status | Show the database connection, RA-CoinsEconomy status, and polling interval | Admin |
/storesync forcepoll | Poll right now instead of waiting | Admin |
/storesync reload | Reload the config values in memory | Admin |
Permissions
| Permission | Default | Description |
|---|---|---|
rastoresync.admin | op | Manage RA-StoreSync |
License
Developed by RajaAditya — rajaaditya.my.id