mirror of
https://github.com/WiIIiam278/Velocitab.git
synced 2025-11-18 07:14:23 +01:00
Conditional Placeholders can now be used in headers and footers
Updated docs
This commit is contained in:
parent
beed377676
commit
973af9c62a
@ -1,8 +1,6 @@
|
|||||||
Conditional placeholders allow you to display different values based on certain conditions. The format
|
Conditional placeholders allow you to display different values based on certain conditions. The format
|
||||||
is `<velocitab_condition|<condition>|<true>|<false>>` and the relational format is `<velocitab_rel_condition|<condition>|<true>|<false>>`.
|
is `<velocitab_condition|<condition>|<true>|<false>>` and the relational format is `<velocitab_rel_condition|<condition>|<true>|<false>>`.
|
||||||
|
|
||||||
Currently, this system is only available for the `format` and `nametag` fields in the tab groups configuration.
|
|
||||||
|
|
||||||
**Note:** The difference between the two is that relational placeholders are evaluated from the viewer's perspective, while the conditional placeholders are evaluated from the player's perspective.
|
**Note:** The difference between the two is that relational placeholders are evaluated from the viewer's perspective, while the conditional placeholders are evaluated from the player's perspective.
|
||||||
So if you have 200 players, if you use a conditional placeholder, the placeholder will be evaluated 200 times, while if you use a relational placeholder, it will be evaluated 200*200 = 40000 times.
|
So if you have 200 players, if you use a conditional placeholder, the placeholder will be evaluated 200 times, while if you use a relational placeholder, it will be evaluated 200*200 = 40000 times.
|
||||||
Using relational placeholders could be really slow, so it is recommended to not use them unless you need them.
|
Using relational placeholders could be really slow, so it is recommended to not use them unless you need them.
|
||||||
|
|||||||
@ -37,6 +37,18 @@ placeholder_replacements:
|
|||||||
replacement: <aqua>River</aqua>
|
replacement: <aqua>River</aqua>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example for the server placeholder
|
||||||
|
```yaml
|
||||||
|
placeholder_replacements:
|
||||||
|
'%server%':
|
||||||
|
- placeholder: spawn
|
||||||
|
replacement: <bold><#ff8080>Spawn
|
||||||
|
- placeholder: realms
|
||||||
|
replacement: <bold><#ff0000>Realms
|
||||||
|
- placeholder: dungeons
|
||||||
|
replacement: <bold><#00ff00>Dungeons
|
||||||
|
```
|
||||||
|
|
||||||
## Specified cases
|
## Specified cases
|
||||||
|
|
||||||
### Vanish status
|
### Vanish status
|
||||||
|
|||||||
@ -53,4 +53,19 @@ PlaceholderAPI placeholders are cached to reduce plugin message traffic. By defa
|
|||||||
|
|
||||||
## MiniPlaceholders support
|
## MiniPlaceholders support
|
||||||
If you are using MiniMessage [[Formatting]], you can use [MiniPlaceholders](https://github.com/MiniPlaceholders/MiniPlaceholders) with Velocitab for MiniMessage-styled component placeholders provided by other proxy plugins. Install MiniPlaceholders on your Velocity proxy, set the `formatter_type` to `MINIMESSAGE` and ensure `enable_miniplaceholders_hook` is set to `true`
|
If you are using MiniMessage [[Formatting]], you can use [MiniPlaceholders](https://github.com/MiniPlaceholders/MiniPlaceholders) with Velocitab for MiniMessage-styled component placeholders provided by other proxy plugins. Install MiniPlaceholders on your Velocity proxy, set the `formatter_type` to `MINIMESSAGE` and ensure `enable_miniplaceholders_hook` is set to `true`
|
||||||
You can also use [Relational Placeholders](Relational-Placeholders).
|
You can also use [Relational Placeholders](Relational-Placeholders).
|
||||||
|
|
||||||
|
## PLaceholders Replacements
|
||||||
|
Velocitab supports replacing placeholders values with other values.
|
||||||
|
```yaml
|
||||||
|
placeholder_replacements:
|
||||||
|
'%server%':
|
||||||
|
- placeholder: spawn
|
||||||
|
replacement: <bold><#ff8080>Spawn
|
||||||
|
- placeholder: realms
|
||||||
|
replacement: <bold><#ff0000>Realms
|
||||||
|
- placeholder: dungeons
|
||||||
|
replacement: <bold><#00ff00>Dungeons
|
||||||
|
```
|
||||||
|
|
||||||
|
See [[Placeholders-Replacements]] for more information.
|
||||||
@ -652,16 +652,18 @@ public class PlayerTabList {
|
|||||||
public Component getHeader(@NotNull TabPlayer player) {
|
public Component getHeader(@NotNull TabPlayer player) {
|
||||||
final String header = player.getGroup().getHeader(player.getHeaderIndex());
|
final String header = player.getGroup().getHeader(player.getHeaderIndex());
|
||||||
final String replaced = plugin.getPlaceholderManager().applyPlaceholders(player, header);
|
final String replaced = plugin.getPlaceholderManager().applyPlaceholders(player, header);
|
||||||
|
final String withVelocitabPlaceholders = plugin.getPlaceholderManager().formatVelocitabPlaceholders(replaced, player, null);
|
||||||
|
|
||||||
return plugin.getFormatter().format(replaced, player, plugin);
|
return plugin.getFormatter().format(withVelocitabPlaceholders, player, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the component for the TAB list footer
|
// Get the component for the TAB list footer
|
||||||
public Component getFooter(@NotNull TabPlayer player) {
|
public Component getFooter(@NotNull TabPlayer player) {
|
||||||
final String footer = player.getGroup().getFooter(player.getFooterIndex());
|
final String footer = player.getGroup().getFooter(player.getFooterIndex());
|
||||||
final String replaced = plugin.getPlaceholderManager().applyPlaceholders(player, footer);
|
final String replaced = plugin.getPlaceholderManager().applyPlaceholders(player, footer);
|
||||||
|
final String withVelocitabPlaceholders = plugin.getPlaceholderManager().formatVelocitabPlaceholders(replaced, player, null);
|
||||||
|
|
||||||
return plugin.getFormatter().format(replaced, player, plugin);
|
return plugin.getFormatter().format(withVelocitabPlaceholders, player, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user