πŸͺ™Multi-currency System

Nascraft has an integrated multi-currency system to support an unlimited number of different currencies, given that they provide a PlaceholderAPI placeholder and commands to deposit and withdraw from the player's account.

circle-exclamation

By default, vault is the base currency. However, this can easily be changed in the config. Here is an example:

config.yml
# ...
currencies:
  # Currency to be used by default by all items.
  # It will also be the default price for things like discord inventory expansions etc.
  default-currency: 'vault'

  suppliers:

    # Vault has to be installed! This is the default currency.
    vault:
      format: "<gradient:#f09947:#feed81>[AMOUNT]$</gradient>"
      not-enough: "<gradient:#FB6363:#C4B3FD>✘ You don't have enough money to buy that!</gradient>"
      decimal-positions: 3
      top-limit: 9999999
      low-limit: 0.005

    #################################################################
    
    # Example of another kind of currency:
    player-points:
      deposit-cmd: 'playerpoints:p give [USER-NAME] [AMOUNT]'
      withdraw-cmd: 'playerpoints:p take [USER-NAME] [AMOUNT]'
      balance-placeholder: '%playerpoints_points%'
      not-enough: "<gradient:#FB6363:#C4B3FD>✘ You don't have enough points to buy that!</gradient>"
      format: "<gradient:#ba24ff:#e8d1ff>[AMOUNT]p</gradient>"
      decimal-positions: 0
      top-limit: 9999
      low-limit: 10

As you see in the example above, each additional currency apart from vault has to have a unique identifier (In the example: "player-points") and some basic properties:

  • deposit-cmd: -> Command to deposit money into the players account. Has two placeholders: [USER-NAME] and [AMOUNT]

  • withdraw-cmd: -> Command to withdraw money into the players account. Has two placeholders: [USER-NAME] and [AMOUNT]

  • balance-placeholder: -> This is a PlaceholderAPI placeholder that should return the balance of the player as a plain number, without any special format.

  • not-enough: -> This is the message that will be sent to the user when it doesn't have enough money to make a transaction.

  • format: -> This is how the money will be represented. It has one internal placeholder: [AMOUNT]

  • decimal-positions: -> This is the precission in prices with this currency. In the case of playerpoints, as it only accepts integers, the number of decimals is obviously 0.

  • top-limit: -> This is the limit on how high a price with this currency can be.

  • low-limit: -> This is the limit on how low a price with this currency can be

Last updated