Velocitab/docs/Plugin-Message-API.md
William 6f140e4708
feat: Add support for Minecraft 1.21.2/3 (#228)
* First step for 1.21.2

* fix

* feat: start preparing 1.21.2 support

bumps gradle and various build deps

* build: now requires Velocity 3.4.0

* build: use Velocity 3.4.0 from maven

* refactor: cleanup, fix wrong protocol ver in 765

* refactor: minor code cleanup & reformat

* refactor: further code cleanup

* refactor: more minor refactoring work

* docs: document prerequisites for using the plugin message API

* Fixed team packet mapping problem
Fixed problems with SortingOrder packet
Changed scoreboard logic to skip team packets for 1.21.2+ players if nametag is empty

* docs: further grammar fixes to plugin message API docs

* refactor: adjust PPB version checking logic

* build: simplify PPB test logic

* refactor: remove unused code

* refactor: adjust formatting

* refactor: make nametag empty by default

* refactor: suppress warning

* fix: `ConfigurationException` deserializing minimum PPB version string

* refactor: remove unused import

* Bug fixes

* Removed tablist order from all TabPlayer instances when a player leaves

* Fixed problem with data structure

* Removed synchronized

* fix: subscriber order not taking effect

* refactor: minor code style tweaks

---------

Co-authored-by: AlexDev_ <56083016+alexdev03@users.noreply.github.com>
2024-10-28 18:17:36 +00:00

35 lines
1.9 KiB
Markdown

Velocitab provides a plugin message API, to let you do things with Velocitab from your backend servers.
> **Note:** This feature requires sending Update Teams packets. `send_scoreboard_packets` must be enabled in the [`config.yml` file](config-file) for this to work. [More details...](sorting#compatibility-issues)
>
## Prerequisites
To use the Velocitab plugin message API, you must first turn it on and ensure the following:
* That `enable_plugin_message_api` and `send_scoreboard_packets` is set to `true` in your Velocitab [[config file]]
* That `bungee-plugin-message-channel` is set to `true` in your **Velocity proxy config** TOML (see [Velocity config reference](https://docs.papermc.io/velocity/configuration)).
## API Requests from Backend Plugins
### 1 Changing player's username in the TAB list
To change a player's username in the TAB list, you can send a plugin message on the channel `velocitab:update_custom_name` with a `customName` string, where `customName` is the new desired display name.
<details>
<summary>Example &mdash; Changing player's username in the TAB List</summary>
```java
player.sendPluginMessage(plugin, "velocitab:update_custom_name", "Steve".getBytes());
```
</details>
### 2 Update color of player's nametag
To change player's [nametag](nametags) color, you can send a plugin message on the channel `velocitab:update_team_color` with `teamColor` string, where `teamColor` is the new desired name tag color.
You can only use legacy color codes, for example `a` for green, `b` for aqua, etc. Please note this option overrides the color of the glow potion effect if set. [Check here](https://wiki.vg/index.php?title=Text_formatting&oldid=18983#Colors) for a list of supported colors (The value under the "Code" header on the table is what you need).
<details>
<summary>Example &mdash; Changing player's team color</summary>
```java
player.sendPluginMessage(plugin, "velocitab:update_team_color", "a".getBytes());
```
</details>