Functions
Inline functions are short, named utilities you can call from any string that already supports placeholders — menu item names, lore, titles, dialog labels, action arguments, requirement values, chat messages, anywhere the placeholder parser runs. They are designed for the same role that helper methods play in code: take a few values, return one value, drop the result back into the surrounding string.
Syntax
The leading
$introduces a function call.$e(...)is reserved for arithmetic expressions (see Placeholders) and is not parsed as a function.The name accepts
[a-zA-Z0-9_-]characters — letters, digits, underscores, and hyphens, so dash-named built-ins likeformat-number,format-date, andrandom-intare inline-callable. Arguments are separated by commas (,); commas inside nested parentheses are not treated as separators.Each argument is a normal placeholder string. Placeholders inside arguments resolve before the function runs, so you can freely mix raw values,
%placeholder%, nested$other(...)calls, and$e(...)expressions.The function's return value is converted to a string and substituted in-place — so a function call is just an inline value, exactly like a
%placeholder%.
Resolution Order
Functions are looked up in this order:
The per-plugin function registry (anything registered by your own plugin).
The global function registry shared across the network.
If the name is not found, the call is left as UNPARSED_FUNCTION in the resulting string — useful as a visible flag that the registry was wrong or the plugin failed to load.
Built-in Functions
All built-ins live in the global registry, so they are available in every menu, dialog, and item string without any extra configuration.
Numbers
add(input, number, max?)
Adds number to input. If max is supplied, the result is capped: min(input + number, max).
subtract(input, number, min?)
Subtracts number from input. If min is supplied, the result is floored: max(input - number, min).
increment(value, max?)
Returns value + 1. If max is supplied and value >= max, returns value unchanged. Preserves the input's number type (int stays int, double stays double).
decrement(value, min?)
Returns value - 1. If min is supplied and value <= min, returns value unchanged. Preserves the input's number type.
min(number1, number2)
Returns the smaller of two numbers as a double. If either is null it returns the other; if both are null it returns 0.0.
max(number1, number2)
Returns the larger of two numbers as a double, with the same null handling as min.
random-int(min, max)
Returns a pseudo-random integer uniformly distributed in the inclusive range [min, max]. Null handling: both null → 0; only min null → returns max; only max null → returns min.
round(number, decimals?)
Rounds the value to decimals decimal places. decimals defaults to 0. Integers and longs pass through unchanged.
format-number(value, pattern?)
Formats a number using a java.text.DecimalFormat pattern. Defaults to 0.00 when pattern is omitted, null, or blank.
Time
format-date(epoch-millis, mode?)
Formats a long containing milliseconds-since-epoch. mode selects the output:
| Output |
|---|---|
|
|
| Milliseconds between now and the timestamp (signed long). |
| Human-readable duration between now and the timestamp. |
| Date-only |
| Human-readable duration treating the value as a length, not a moment. |
anything else | Used as a |
Built-in Function Summary
Name | Signature | Returns |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Random int in |
|
| Half-up rounded |
|
|
|
|
| Formatted timestamp |
Registering Your Own Functions
See Custom Functions for the developer API.