Dynamic Price

Step 1

Change your config.yml file:

  • For 1.2.8 user: Change check-math: false to check-math: true.

  • For 1.2.9+ user: Change

math:
  # Enabled base math calculate?
  # Will support + - * / only.
  enabled: false

to

math:
  # Enabled base math calculate?
  # Will support + - * / only.
  enabled: true
  • Change

placeholder:
  data:
    can-used-in-amount: false

to

placeholder:
  data:
    can-used-in-amount: true

Step 2

Open one of your shop configs, find the product you want to enable dynamic price.

Like I want to enable for this product:

  A:
    display-name: 'Custom Name!'
      price-mode: ALL
    product-mode: CLASSIC_ALL
    products:
      1:
        material: sea_lantern
    buy-prices:
      1:
        economy-type: exp
        amount: '5+{buy-times-server}*0.2-{sell-times-server}*0.1'
        max-amount: 15
        min-amount: 1
        start-apply: 0
        placeholder: '{amount} Exp'
    sell-prices:
      1:
        economy-type: exp
        amount: '5+{buy-times-server}*0.2-{sell-times-server}*0.1'
        max-amount: 15
        min-amount: 1
        start-apply: 0
        placeholder: '{amount} Exp'

First, you need set price-mode to ALL or ANY.

Set amount option to the value I set here, it is a math string, if your math is not good, let me explain it:

  • 5 is base price, which means the start price.

  • 0.2 is each time one player buy one this product, then the price will plus this value.

  • 0.1 is each time one player sell one this product, then the price will delete this value.

We also added max-amount and min-amount option, to avoid price is too high or too low.

Showcase

Dynamic Price Status - Premium

Start from 2.3.2, you can use {status} placeholder in price section's amount option, like this:

    buy-prices:
      1:
        economy-plugin: Vault
        amount: '550+{buy-times-server}*0.2-{sell-times-server}*0.1'
        max-amount: 5500
        min-amount: 325
        placeholder: '&6{amount} Coins {status}' # <--- We use {status} here.
        start-apply: 0

Please note that to use this placeholder, you have to make sure in amount option, the first number is base price. Like here, 550 is the base price.

You can also enable add-status-in-dynamic-price-placeholde option in config.yml to let plugin auto add this for you, you don't need have to manually add the placeholder at each price placeholder!

Last updated