Add %server_group% and %server_group_index% placeholders

This commit is contained in:
William278 2023-09-25 15:19:32 +01:00
parent cb8a50c24f
commit 2afbf38ee1
3 changed files with 6 additions and 2 deletions

View File

@ -17,7 +17,9 @@ Placeholders can be included in the header, footer and player name format of the
| `%suffix%` | The player's suffix (from LuckPerms) | `&c ` |
| `%role%` | The player's primary LuckPerms group name | `admin` |
| `%role_display_name%` | The player's primary LuckPerms group display name | `Admin` |
| `%debug_team_name%` | Internal team value, used for list sorting | `1_alpha_William2` |
| `%server_group%` | The name of the server group the player is on | `default` |
| `%server_group_index%` | Indexed order of the server group in the list | `0` |
| `%debug_team_name%` | (Debug) Player's team name, used for [[Sorting]] | `1alphaWilliam278` |
### Customising server display names
You can make use of the `server_display_names` feature in `config.yml` to customise how server display name appear when using the `%server%` placeholder. In the below example, if a user is connected to a server with the name "`very-long-server-`name" and the player name format for the group that server belongs to includes a `%server%` placeholder, the placeholder would be replaced with "`VSLN`" instead of the full server name.

View File

@ -51,6 +51,8 @@ public enum Placeholder {
ROLE((plugin, player) -> player.getRole().getName().orElse("")),
ROLE_DISPLAY_NAME((plugin, player) -> player.getRole().getDisplayName().orElse("")),
ROLE_WEIGHT((plugin, player) -> Integer.toString(player.getRole().getWeight())),
SERVER_GROUP((plugin, player) -> player.getServerGroup(plugin)),
SERVER_GROUP_INDEX((plugin, player) -> Integer.toString(player.getServerGroupPosition(plugin))),
DEBUG_TEAM_NAME((plugin, player) -> plugin.getFormatter().escape(player.getLastTeamName().orElse("")));
/**

View File

@ -43,7 +43,7 @@ public class Protocol403Adapter extends TeamsPacketAdapter {
ProtocolVersion.MINECRAFT_1_17_1,
ProtocolVersion.MINECRAFT_1_18_2,
ProtocolVersion.MINECRAFT_1_19_4,
ProtocolVersion.MINECRAFT_1_20
ProtocolVersion.MINECRAFT_1_20,
));
}