Random - Premium

We added {random} built-in placeholder in premium version.

Configure

  • Open config.yml, find below contents:

placeholder:
  # Premium version only.
  random:
    rotate:
      reset-mode: TIMED
      reset-time: '00:00:00'
      elements:
        - 'A'
        - 'B'
        - 'C'
    daily-shop:
      reset-mode: TIMED
      reset-time: '00:00:00'
      elements:
        - 'rotate' # This means this placeholder will include all rotate placeholder elements.

Change the value you'd like.

  • reset-mode: Can be set to TIMER, TIMED, ONCE. For TIMER and TIMED, please view Shop page to know more, and for ONCE, this placeholder will refresh each used.

  • reset-time: Please view Shop page to know more.

  • element-amount: The amount of the element will picked. (Added in 3.1.0)

  • elements: The random element what placeholder will picked.

    • Support use ~ symbol means pick random number, for example, 5~100 means pick one random number from 5 to 100.

    • Support use other placeholder ID to make this placeholder will include all elements it has, like we put rotate into daily-shop placeholder's elements option can be seen as:

    • For performance and safety reasons, start from 3.1.0 version, this approach can only be used once for nesting.

placeholder:
  # Premium version only.
  random:
    rotate:
      reset-mode: TIMED
      reset-time: '00:00:00'
      elements:
        - 'A'
        - 'B'
        - 'C'
    daily-shop:
      reset-mode: TIMED
      reset-time: '00:00:00'
      element-amount: 2
      elements:
        - 'A'
        - 'B'
        - 'C'
  • not-same-as: Add other placeholder ID here, after add, we can make sure this placeholder value won't same as the placeholder you put here. Please note that if we can't find any appropriate value, an error prompt will appear. (Removed in 3.1.0)

Use Placeholder

Use {random_<ID>;;<Number>} placeholder to display it's value, like {random_daily;;2} will query daily random placeholder's second element picked. For more info, please view Placeholders page. For example of this placeholder usage, please view Daily Shop page.

Example: Random Price

Create new random placeholder

Read Rotate Product page first. In this example, we create a new random placeholder called price at config.yml.

  random:
    price:
      reset-mode: TIMED
      reset-time: '00:00:00'
      elements:
        # Random number from 5 to 100.
        - '5~100'

Set dynamic value in your product configs

Use {random_price} placeholder at any product's price config. Like I add this placeholder in this product:

items:
  A:
    price-mode: CLASSIC_ALL
    product-mode: CLASSIC_ALL
    products:
      1:
        material: coal
        amount: 1
    buy-prices:
      1:
        economy-plugin: Vault
        amount: '{random_price}' # <--- Changed line
        placeholder: '&6{amount} Coins'
        start-apply: 0
    buy-limits:
      global: 320
      default: 240
      vip: 320
    buy-limits-conditions:
      vip:
        - 'permission: group.vip'
    buy-limits-reset-mode: 'TIMED'
    buy-limits-reset-time: '00:00:00'

Last updated