layer-plusActions System

Actions System Documentation

The Actions System in Phantom Vouchers allows you to define custom behaviors that are executed when a voucher is redeemed. Actions are specified in the redeem-actions section of a voucher configuration file and are executed in the order they are listed. The system supports a variety of actions, including commands, messages, sounds, and more.

Supported Actions

1. [MESSAGE]

Sends a message to the player who redeemed the voucher.

Syntax:

[MESSAGE] <message>

Example:

[MESSAGE] &aYou have redeemed your voucher!

2. [COMMAND]

Executes a server command as if it were run by the console. Use %player% to reference the player who redeemed the voucher.

Syntax:

[COMMAND] <command>

Example:

[COMMAND] give %player% diamond 1

3. [SOUND]

Plays a sound to the player who redeemed the voucher.

Syntax:

Example:


4. [TITLE]

Displays a title and subtitle to the player.

Syntax:

Example:


5. [ACTION_BAR]

Displays a message in the player's action bar.

Syntax:

Example:


6. [RANDOM]

Executes a set of actions with a specified chance. If the chance is met, all actions in the set are executed.

Syntax:

Example:


7. [SET_VAR]

Sets a variable to a value, which can be used in subsequent actions. Supports placeholders like %random_<min>_<max>% for generating random numbers.

Syntax:

Example:


8. [VAR]

References a previously set variable. Use %var_<variable_name>% to insert the variable's value into an action.

Example:


9. [COLOR]

Supports color codes and hex values for messages, titles, and action bars. Use & for color codes and # for hex values.

Syntax:

Example:

Notes:

  • Hex values must start with # and can be used alongside traditional color codes.

  • Supported in [MESSAGE], [TITLE], and [ACTION_BAR] actions.


Advanced Examples

Example 1: Simple Reward

Example 2: Randomized Rewards

Example 3: Using Variables


Notes

  • Actions are executed in the order they are listed unless a [RANDOM] action is used.

  • Variables set with [SET_VAR] can be reused in subsequent actions.

  • Ensure proper syntax to avoid errors during execution.

For more information or assistance, refer to the plugin's documentation or contact support.

Last updated