🔀Random Placeholder - Premium
We added {random} built-in placeholder in premium version.
Config
All random placeholder configs are stored in random_placeholders folder. The file name is it's ID, for example: rotate.yml means it's ID is rotate. An example of it's config is like below:
reset-mode: TIMED
reset-time: '00:00:00'
per-player-element: true
element-sort: true
element-amount: 5
elements:
A:
rate: 1
conditions:
1:
type: permission
permission: 'test.permission'
B:
rate: 5
C:
rate: 2
D:
rate: 5
E:
rate: 2
F:
rate: 15
G:
rate: 7per-player-element: If set to
false, all players will use the same value output by random placeholder. For example, player 1 will get A, and player 2 will get the same value, even if the player reaches 100 million, the value will be the same. If set totrue, the values output by each player will be different from each other, and conditions can be set for elements. If an element does not meet the conditions, the player will never be able to extract it.
element-sort: If set to
false, the result of the random placeholder will be out of order. For example, if you setelementstoA, B, C, D, Eand the randomly generated result isB, D, the result of the random placeholder may beB, D, orD, B. However, if set totrue, the result will be output strictly in the order of elements, and the output result can only beB, D. (Added in 3.12.2)reset-mode/reset-time: Please view below to know.
element-amount: The amount of the element will picked in this placeholder. (Added in 3.1.0)
elements: The random element what placeholder will picked.
There are two ways to express elements.
The first is to write all elements in the form of a list, where the rate of each element is equal and without any conditions. Support use ~ symbol means pick random number, for example, 5~100 means pick one random number from 5 to 100.
elements:
- 'A'
- 'B'
- 'C'elements:
# Random number from 5 to 100.
- '5~100'The second is to use the form of subsections, where each element has options for rate and conditions to fill in. The conditions option is not required and only support when per-player-element being set to true. (Added in 3.12.0)
elements:
A:
rate: 1
conditions:
1:
type: permission
permission: 'test.permission'
B:
rate: 5
C:
rate: 2Use 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.
Reset Placeholder
You can reset placeholder by setting reset-mode and reset-time option.
Supports below reset mode:
ONCE: Each time it is used, it will reset and is not applicable to the price, as the price seen by the player opening the store and the actual transaction result are calculated twice, so you cannot achieve price synchronization.
TIMER/TIMED/NEVER: Please view this page to know more. We will generate reset time after random placeholder be used once. The reset time will not automatically adjust based on configuration updates. If you set the reset time incorrectly, you will need to delete the corresponding data.
For more info, please view this page.
Example: Random Price
Create new random placeholder
In this example, we create a new random placeholder config called price.yml at random_placeholder folder.
reset-mode: TIMED
reset-time: '00:00:00'
element-sort: true
element-amount: 50
elements:
# Random number from 5 to 100.
- '5~100'
- '4~40'
- '53~530'
- '32~140'
- '55~140'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;;1}' # <--- Changed line
placeholder: '&6{amount} Coins'
start-apply: 0Last updated