A "multi-server" Economy Plugin (Powered by Lettuce)
Please report bugs here if any
Any proxy (Bungee,Velocity...)
Any Spigot (Paper,Purpur...)
Any Spigot (Paper,Purpur...)
To enable migration on startup:
-
Code (YAML):migration-enabled : true #Set this to true
- Keep in mind that vault economy is disabled during migration
- You do not need to put the plugin in your proxy.
- Just drop it in your Spigot's plugins folder
- Then modify redis credentials in config.yml (leave blank user or password if you do not have it set)
- Choose a server-id different for every instance of Spigot in config.yml Now it is automatic
- You can configure multiple currencies in config.yml
- But keep in mind that only the "vault" currency would be used by other plugins
- It is not possible to delete the vault currency: it is the default one
- All currencies support offline payments!
- You can charge a fee on payments sent
- High compatibility with Vault: all currencies are Vault's Economy instances
- Player Command
- balance/money - Displays your balance (vault/default currency)
- balance/money <player> [currency] - Displays <player>'s balance
- pay <player> <amount> [currency] - Pay <player> <amount>. you can specify the currency used
- balancetop/baltop - Displays the top 10 richest accounts (with vault/default currency)
- OP Command
- balance/money <player> <currency> give <amount> [reason...]
- balance/money <player> <currency> take <amount> [/command... or reason...] - Takes money from a player. It is possible to specify a command to execute if the player has sufficient funds
- balance/money <player> <currency> set <amount> - Purely for moderation
- transaction <player> [beforedate] [afterdate] - View transactions of a player (you can navigate inside it: all the playernames are clickable)
- purge-balance <player-regex> - Purges the balance of the players matching the regex (ex. Steve(.*) matches SteveCarell and Steve_)
- More commands are coming...
- Permissions
- rediseconomy.pay - Allows the use of /pay
- rediseconomy.balance - Allows player to look up balances
- rediseconomy.balance.currencyname - Allows player to look up balances with that currencyname
- rediseconomy.balancetop - Allow player to use /balancetop
- rediseconomy.admin - Allow to use OP commands
- rediseconomy.pay.currencyname - Allows player to pay with that currency and specify a reason for the payment
[dropdown="config.yml with explanation"]
Code (YAML):
#ServerID - you need a different server id for every instance
server-id : "server-1"
#Transaction history size (how many transactions are saved per-player
transactions-retained : 200
#Set this to true if you want to migrate accounts
migration-enabled : false
redis:
host : "localhost"
port : 6379
user : "redis" #delete this key or leave it blank for none
password : "password" #delete this key or leave it blank for none
database : 0 #Redis database used (default on server is 0)
timeout : 0 #Jedis timeout
lang:
no-console : "<red>You must be in-game to use this command!</red>"
no-permission : "<red>You do not have permission to use this command!</red>"
player-not-found : "<red>Player not found!</red>"
invalid-amount : "<red>Invalid amount!<"
insufficient-funds : "<red>You do not have enough money!</red>"
balance : "<green>You have %balance%!</green>"
balance-set : "<green>You set %player% account to %balance% !</green>"
balance-other : "<green>%player% has %balance% !</green>"
balance-top : "<green>Top richest players:</green><br>%prevpage% %page% %nextpage%"
balance-top-format : "<aqua>%pos% - %player% %balance%</aqua>"
pay-self : "<red>You cannot pay yourself!</red>"
pay-success : "<green>You paid %player% %amount%!</green>"
pay-fail : "<red>Pay failed!</red>"
pay-received : "<green>You received %amount% from %player%!</green>"
transaction-item : "<aqua>%timestamp%</aqua> <click:run_command:/transaction %sender% %afterbefore%><dark_green>%sender%</dark_green></click> -> <click:run_command:/transaction %receiver% %afterbefore%><green>%receiver%<green></click> %amount%!"
currencies:
vault:
currency-single : "$"
currency-plural : "$"
starting-balance : 0
pay-tax : 0 # relative percentage 1 is 100% 0 is 0%
zircon:
currency-single : "z"
currency-plural : "zs"
starting-balance : 1
pay-tax : 0.1 # relative percentage 1 is 100% 0 is 0%
server-id : "server-1"
#Transaction history size (how many transactions are saved per-player
transactions-retained : 200
#Set this to true if you want to migrate accounts
migration-enabled : false
redis:
host : "localhost"
port : 6379
user : "redis" #delete this key or leave it blank for none
password : "password" #delete this key or leave it blank for none
database : 0 #Redis database used (default on server is 0)
timeout : 0 #Jedis timeout
lang:
no-console : "<red>You must be in-game to use this command!</red>"
no-permission : "<red>You do not have permission to use this command!</red>"
player-not-found : "<red>Player not found!</red>"
invalid-amount : "<red>Invalid amount!<"
insufficient-funds : "<red>You do not have enough money!</red>"
balance : "<green>You have %balance%!</green>"
balance-set : "<green>You set %player% account to %balance% !</green>"
balance-other : "<green>%player% has %balance% !</green>"
balance-top : "<green>Top richest players:</green><br>%prevpage% %page% %nextpage%"
balance-top-format : "<aqua>%pos% - %player% %balance%</aqua>"
pay-self : "<red>You cannot pay yourself!</red>"
pay-success : "<green>You paid %player% %amount%!</green>"
pay-fail : "<red>Pay failed!</red>"
pay-received : "<green>You received %amount% from %player%!</green>"
transaction-item : "<aqua>%timestamp%</aqua> <click:run_command:/transaction %sender% %afterbefore%><dark_green>%sender%</dark_green></click> -> <click:run_command:/transaction %receiver% %afterbefore%><green>%receiver%<green></click> %amount%!"
currencies:
vault:
currency-single : "$"
currency-plural : "$"
starting-balance : 0
pay-tax : 0 # relative percentage 1 is 100% 0 is 0%
zircon:
currency-single : "z"
currency-plural : "zs"
starting-balance : 1
pay-tax : 0.1 # relative percentage 1 is 100% 0 is 0%
Config messages formatting:
- Minimessage: you can find the format here
- Support for infinite multiple currencies
- Migration of accounts from other economy plugins
- Rollback account balances with transactions
- add conditional commands on /balance take if the player has the amount required (useful for GUIs)
- Automatic server-id detection
- Language configuration
- Switch currency names and databases
- Transaction reasons
Placeholders:
- %rediseco_bal_<currency>% - returns the balance with 2 decimals
- %rediseco_bal_formatted_<currency>% - returns the balance with 2 decimals with currency symbol
- %rediseco_bal_short_<currency>% - returns the balance with the unit symbol specified in the config (millions,billions,thousands...)
- You can use both of them toghether (ex. %rediseco_bal_formatted_short_vault%)
- %rediseco_totsupply_<currency>% - all the circulating money of this currency (you can use _formatted and _short parameters)
API for developers:
https://github.com/Emibergo02/RedisEconomy#api-usage
[dropdown="API usage"]
Code (Java):
// Access Point
RedisEconomyAPI api = RedisEconomyAPI. getAPI ( ) ;
if (api == null ) {
Bukkit. getLogger ( ). info ( "RedisEconomyAPI not found!" ) ;
}
//get a Currency
Currency currency = api. getCurrencyByName ( "vault" ) ; //Same as api.getDefaultCurrency()
api. getCurrencyBySymbol ( "€" ) ; //Gets the currency by symbol
//Currency is a Vault Economy https://github.com/MilkBowl/VaultAPI/blob/master/src/main/java/net/milkbowl/vault/economy/Economy.java,
//same methods and everything
currency. getBalance (offlinePlayer ) ;
currency. withdrawPlayer (offlinePlayer, 100 ) ;
//Modify a player balance (default currency)
api. getDefaultCurrency ( ). setPlayerBalance (player. getUniqueId ( ), 1000 ) ;
//Get all accounts from currency cache
api. getDefaultCurrency ( ). getAccounts ( ). forEach ( (uuid, account ) -> {
Bukkit. getLogger ( ). info ( "Account: " +uuid + ", Balance: " +account ) ;
} ) ;
//Direct data from redis. (Not recommended)
api. getDefaultCurrency ( ). getOrderedAccounts ( ). thenAccept (accounts -> {
accounts. forEach (account -> {
Bukkit. getLogger ( ). info ( "UUID: " +account. getElement ( ) + ", Balance: " +account. getScore ( ) ) ;
} ) ;
} ) ;
api. getDefaultCurrency ( ). getAccountRedis (uuid ). thenAccept (account -> {
Bukkit. getLogger ( ). info ( "Balance: " + account ) ;
} ) ;[/dropdown] [/dropdown]
RedisEconomyAPI api = RedisEconomyAPI. getAPI ( ) ;
if (api == null ) {
Bukkit. getLogger ( ). info ( "RedisEconomyAPI not found!" ) ;
}
//get a Currency
Currency currency = api. getCurrencyByName ( "vault" ) ; //Same as api.getDefaultCurrency()
api. getCurrencyBySymbol ( "€" ) ; //Gets the currency by symbol
//Currency is a Vault Economy https://github.com/MilkBowl/VaultAPI/blob/master/src/main/java/net/milkbowl/vault/economy/Economy.java,
//same methods and everything
currency. getBalance (offlinePlayer ) ;
currency. withdrawPlayer (offlinePlayer, 100 ) ;
//Modify a player balance (default currency)
api. getDefaultCurrency ( ). setPlayerBalance (player. getUniqueId ( ), 1000 ) ;
//Get all accounts from currency cache
api. getDefaultCurrency ( ). getAccounts ( ). forEach ( (uuid, account ) -> {
Bukkit. getLogger ( ). info ( "Account: " +uuid + ", Balance: " +account ) ;
} ) ;
//Direct data from redis. (Not recommended)
api. getDefaultCurrency ( ). getOrderedAccounts ( ). thenAccept (accounts -> {
accounts. forEach (account -> {
Bukkit. getLogger ( ). info ( "UUID: " +account. getElement ( ) + ", Balance: " +account. getScore ( ) ) ;
} ) ;
} ) ;
api. getDefaultCurrency ( ). getAccountRedis (uuid ). thenAccept (account -> {
Bukkit. getLogger ( ). info ( "Balance: " + account ) ;
} ) ;[/dropdown] [/dropdown]