Economy System

Create a complete economy system with virtual currency, shops, and player balances using Command Maker's custom syntax and variables.

Basic Setup

First, set up your economy variables. Each player will need their own ${balance} variable initialized:

/setcmdvariable currency_name "Coins"
/setcmdvariable balance 0

Per-Player Balances

Variables like ${balance} are per-player — each player has their own value. When you run /setcmdvariable balance 0, it only sets the balance for the player running the command. Use command blocks or a setup command to initialize balances for new players automatically.

Balance Commands

Create commands to check and manage player balances:

/cmd add balance tellraw ${player} {"text":"Your balance: ${balance} ${currency_name}","color":"green"}
/cmd add pay tellraw ${player} {"text":"Paid ${amount} ${currency_name} to ${target}","color":"yellow"} && tellraw ${target} {"text":"Received ${amount} ${currency_name} from ${player}","color":"green"}

Shop System

Use custom syntax to create a shop system:

// In syntax.json
{
  "buy": {
    "pattern": "/buy  ",
    "description": "Buy items from the shop"
  }
}

// In aliases.json
{
  "buy_diamond": "give ${player} diamond ${buy_amount} && tellraw ${player} {\"text\":\"Bought ${buy_amount} diamonds for ${price} ${currency_name}\",\"color\":\"green\"}"
}

Earning Currency

Create ways for players to earn currency:

/cmd add daily give ${player} emerald 1 && tellraw ${player} {"text":"Daily reward: 1 Emerald!","color":"gold"}
/cmd add work tellraw ${player} {"text":"You worked hard and earned 50 ${currency_name}!","color":"green"}