An open API service indexing awesome lists of open source software.

https://github.com/miniplaceholders/expressions-expansion

A MiniPlaceholders placeholder that allows you to modify placeholders
https://github.com/miniplaceholders/expressions-expansion

miniplaceholders-expansion

Last synced: 10 months ago
JSON representation

A MiniPlaceholders placeholder that allows you to modify placeholders

Awesome Lists containing this project

README

          

# Expressions-Expansion
Expressions Expansion for MiniPlaceholders.

## Placeholders
### Basic Operations
- **Addition** | ``
- `` == 10
- **Subtraction** | ``
- `` == 7
- **Multiplication** | ``
- `` == 180
- **Division** | ``
- `` == 2
- **Division remainder** ``
- `` == 1
- **Negation** | ``
- `` == -5
- `` == 5
### Round
- **Round down to integer** | ``
- `` == 5
- `` == 2
- **Round to nearest integer** | ``
- `` == 5
- `` == 3
- **Round up to integer** | ``
- `` == 6
- `` == 3
- **Get the lowest-valued number** | ``
- `` == 2
- **Get the highest-valued number** | ``
- `` == 500
- **A random number from 0 to 1** | `` | Acts like ``
- `` == 0.15
- **A random integer from `min` to `max`** | `` | Acts like ``
- `` == 69
- **A random number from `min` to `max` with a step of `step`** | ``
- `` == 68.75

### String Operations
- **Concat strings** | ``
- `` == "hello_world"
- **Create a substring of `s` from `n1` to `n2` character** | ``
- `` == "ll"
- **Get length of the string** | ``
- `` == 5
- **Format a string using [Java String.format()](https://www.javatpoint.com/java-string-format)** | ``
| *It may be useful for [user expressions](#User-expressions)*
- `` == "4drian3d is not a fruit"
- **Displays `r1` if `o1` and `o2` are same. Otherwise, displays `rs`** | ``
- `` == "NotEquals"
- **Sets `text` placeholders for a player with `uuid`.** | ``
- `>` == 4drian3d
- **Sets `text` placeholders for a player with `name`.** | ``
- `>` == 42
- **Expand to a [User expression](#User-expressions)** | ``

## User expressions
You can create your own expression shortcut in config.yml using our Expression Expansion Language (EEL):

`add_and_multiply: "':'\\':\\'\\'>'>"` means `` will be evaluated to `arg1 + (arg2 * arg3)`. So, `` evaluates to `'>`, which is `2 + (3 * 4) = 14`

### Example user expressions
- `` - Remove `n` first characters from `s` (`hello`, `2` -> `llo`), EEL: ` remove_first: "':'':'\\'>'>"`
- `` - Remove `n` last characters from `s` (`hello`, `2` -> `hel`), EEL: `remove_last: "':0:'\\\\\\'>\\':\\'\\'>'>"`
- `` - format a number (`1.234567`, `2` -> `1.23`), EEL: `decimals: "\\':\\'f\\'>':''>"`
- `` - pad an integer with zeros (`12`, `3` -> `012`), EEL: `pad_integer: "\\':\\'d\\'>':''>"`

## Nesting
Expressions can be nested. Try `/miniplaceholders parse me "\\\\\\\\\\\\\\'>\\\\\\'>\\'>'>"`

## Downloads
[![](https://raw.githubusercontent.com/Prospector/badges/master/modrinth-badge-72h-padded.png)](https://modrinth.com/plugin/expressions-expansion)