Mathematical Expressions
RewardSystem allows you to use mathematical expressions in your config.yml file. These expressions enable you to create dynamic rewards based on player level, damage dealt, and other metrics.
Basic Syntax
Mathematical expressions use the following format: {math:expression}
For example:
Chance Expressions
Chance expressions are created by adding a percentage sign (%) at the end of the command:
This gives a 20% chance (10 + 5*2 = 20%) if the player's level is 5.
Configuration Example
Available Variables
You can use the following variables in your mathematical expressions:
%player_level%
: Player's level%personal_damage%
: Damage dealt by the player to the mob%top_damage_1%
,%top_damage_2%
, etc.: Damage values on the leaderboardAll other values provided by PlaceholderAPI
Supported Operations
Addition:
+
Subtraction:
-
Multiplication:
*
Division:
/
Modulo (remainder):
%
Parentheses:
(expression)
Example Uses
Reward amount based on player level:
Chance based on damage dealt:
Simple calculations:
Multi-step calculations with parentheses:
Using server statistics:
Error Handling
If an expression cannot be evaluated (syntax error, variable issue, etc.), the system:
For chance calculations: uses a default 50% chance
For item amounts: uses a default value of 1
This ensures that commands continue to work even when mathematical expressions have issues.
Practical Tips
Keep expressions simple for better performance
Test your expressions with various player levels and damage values
Use debug mode to verify that expressions are evaluated correctly
Consider edge cases like new players (low levels) or very high damage values
Last updated