Conditionals

Using conditionals in the GPT Assistant Minecraft plugin can drastically improve the functionality of your server by creating intuitive responses to players' queries.

1. The Equality Operator "==":

The "==" operator checks if two values are equal.

Example:

(%vault_eco_balance% == 0) ? 'You have no money' : 'You have money'

2. The Identity/Strict Equality Operator "===":

The "===" operator checks if two values are equal AND if they are of the same type.

Example:

('%luckperms_primary_group_name%' === 'vip') ? 'You are a VIP' : 'You are not a VIP'

3. The Greater Than Operator ">":

It checks if a value is greater than the other value.

Example:

(%player_ping% > 250) ? 'High ping' : 'Low ping'

4. The Less Than Operator "<":

It checks if a value is less than the other value.

Example:

5. The Greater Than or Equal To Operator ">=":

It checks if a value is greater than or equal to the other value.

Example:

6. The Less Than or Equal To Operator "<=":

It checks if a value is less than or equal to the other value.

Example:

7. The Not Equal Operator "!=":

It checks if two values are not equal.

Example:

8. The Logical And Operator "&&":

It is used to test more than one condition.

Example:

9. The Logical Or Operator "||":

It is used to test at least one condition.

Example:

10. Using Single Quotes "'":

If you want to specify a string or text, you should put it inside single quotes ''.

Example:

But if you need to use a single quote inside a string, you should escape it using a backslash.

Example:

11. Using Double Quotes "":

Same as single quotes, they are used to indicate a string or text, but can cause problems when used within YML files. Stick with single quotes.

12. Plus Operator "+":

You can use the "+" operator to add/caoncatenate things.

Example of concatenation:

Hopefully, this guide helps you understand how to use and create conditional statements. Feel free to test out different combinations and build upon this knowledge!

Last updated