Skip to content

Mini guides collection

NEZNAMY edited this page Sep 12, 2023 · 68 revisions

Content

Combine the knowledge gathered by reading the wiki to get interesting results, most frequently asked ones listed here.

Displaying kill / death counter in tablist

This example uses PlaceholderAPI placeholders.
Kills:

yellow-number-in-tablist: 
  enabled: true
  value: "%statistic_player_kills%"

Deaths:

yellow-number-in-tablist: 
  enabled: true
  value: "%statistic_deaths%"

Note: These values are taken from server stats. You can modify / reset them for each player in <main world>/stats/<player uuid>.json file.

Taking prefixes/suffixes from permission plugin

Delete all groups from groups.yml and only keep this:

_DEFAULT_:
  tabprefix: "%vault_prefix%"
  tagprefix: "%vault_prefix%"    
  tabsuffix: "%vault_suffix%"    
  tagsuffix: "%vault_suffix%"

This requires Vault and a permission plugin to work.
If you have luckperms installed on the same server instance, you can use TAB's internal %luckperms-prefix% (and suffix) placeholders instead.
Note: If TAB is on bungeecord and you want prefixes to be taken from backend servers, use %vault_prefix% (or %luckperms_prefix%) with PlaceholderAPI support on bungeecord.

Showing player version in tablist

Run /tab group _DEFAULT_ tabsuffix " &8[&3%player-version%&8]" or any other color combination you want.
If you want it aligned on the right, enable Aligned tabsuffix.

Replicating Purpur's TPSBar

This guide was made purely for demonstration of TAB's functionality to show you can even do things like this with conditions. It is not meant to be used as a replacement for Purpur or any of its functions or discouraging users from using Purpur.

By default, Purpur's TPSBar shows server's TPS, MSPT and player ping. These change color from green to red based on value. The easier way to achieve this is with Placeholder output replacements, however, it alters placeholders everywhere inside TAB, which would result in features like Yellow number to stop working correctly when %ping% is used, since it would contain color codes now. For that reason, we will use Conditions instead.

When TPS is above 19, it displays as <#55FF55>value</#00AA00>. When above 15, <#FFFF55>value</#FFAA00>, otherwise <#FF5555>value</#AA0000>. This can be achieved with 2 conditions:

conditions:
  tps:
    conditions:
      - "%tps%>=19"
    yes: "<#55FF55>%tps%</#00AA00>"
    no: "%condition:tps2%"
  tps2:
    conditions:
      - "%tps%>=15"
    yes: "<#FFFF55>%tps%</#FFAA00>"
    no: "<#FF5555>%tps%</#AA0000>"

To use this, we will use %condition:tps%.
Now, repeat for mspt and ping. For mspt, purpur's intervals are <40, <50, 50+. For ping, it's <100, <200, 200+.

Conditions for mspt and ping may look something like this:

conditions:
  mspt:
    conditions:
      - "%mspt%<40"
    yes: "<#55FF55>%mspt%</#00AA00>"
    no: "%condition:mspt2%"
  mspt2:
    conditions:
      - "%mspt%<50"
    yes: "<#FFFF55>%mspt%</#FFAA00>"
    no: "<#FF5555>%mspt%</#AA0000>"
  ping:
    conditions:
      - "%ping%<100"
    yes: "<#55FF55>%ping%</#00AA00>"
    no: "%condition:ping2%"
  ping2:
    conditions:
      - "%ping%<200"
    yes: "<#FFFF55>%ping%</#FFAA00>"
    no: "<#FF5555>%ping%</#AA0000>"

To use them, we will use %condition:mspt% and %condition:ping%. Purpur's TPSBar is using mspt as bossbar progress with range from 0 to 50. This can be achieved with PlaceholderAPI's math expansion: %math_0_{tab_placeholder_mspt}*2%. It always uses GREEN color and NOTCHED_20 style. Let's put all of this together:

  bars:
    tpsbar:
      style: NOTCHED_20
      color: GREEN
      progress: "%math_0_{tab_placeholder_mspt}*2%"
      text: "&7TPS&e: %condition:tps% &7MSPT&e: %condition:mspt% &7Ping&e: %condition:ping%&7ms"

The last step is to configure when should this bossbar be displayed. One way is to use bossbar announce/send command. Another is to use display conditions. An example can look like display-condition: "permission:tab.tpsbar. Now, only players with the permission will see the bossbar.

BedWars1058 compatibility

Sorting

To sort teams through TAB, add the PLACEHOLDER_A_TO_Z sorting type with the %bw1058_player_team% placeholder. Example:

sorting-types:
  - "PLACEHOLDER_A_TO_Z:%bw1058_player_team%"
  - "GROUPS:admin,mod,default"
  - "PLACEHOLDER_A_TO_Z:%player%"

Team name in tablist/nametag

To display the team name in the tablist, use this command: /tab group _DEFAULT_ tabprefix %bw1058_player_team%
The same goes for the nametag, but with tagprefix instead: /tab group _DEFAULT_ tagprefix %bw1058_player_team%

To display only the first letter of the team, download this PlaceholderAPI expansion: https://api.extendedclip.com/expansions/bw1058plus/ and use %bw1058plus_team_letter% instead, if you want the color as well, put %bw1058plus_team_color% right before.

Rank in lobby & Team name in game

If you want to display the rank of the player while he's in the lobby or waiting lobby, BUT show the team name while in game, then don't worry, there's a way =)
You can create a condition which checks if the player's current team = nothing (which means the player isn't playing), and return either the rank or the team name depending on that condition. Example:

conditions:
  rankOrTeam:
    conditions:
      - "%bw1058_player_team%="
    yes: "%luckperms-prefix%"
    no: "%bw1058_player_team%"

And then do /tab group _DEFAULT_ tabprefix %condition:rankOrTeam% and /tab group _DEFAULT_ tagprefix %condition:rankOrTeam% so it shows in your nametag and in your tablist name.

Moving nametag when player wears a hat

Unfortunately, there is no simple solution to this problem. We are going to use conditions with unlimited nametag mode to reach our results.

First, enable unlimited nametag mode by setting

scoreboard-teams:
  enabled: true
  unlimited-nametag-mode:
    enabled: true

in config.yml.

Second, define static lines, which will be used in case player has a hat. Let's make them 1 block higher than normal (hint: default space between lines is 0.26 blocks).

  unlimited-nametag-mode:
    enabled: true
    dynamic-lines:
      - abovenameNormal
      - nametagNormal
      - belownameNormal
    static-lines:
      abovenameHat: 1.52
      nametagHat: 1.26
      belownameHat: 1

Now, we are going to assume your configuration is taking prefixes/suffixes from permission plugin, because otherwise we would end up with a TON of conditions, which would take too much brain power create and maintain. Let's create 2 conditions: 1 for having a hat, 1 for not having a hat. In the example, we will use %magicosmetics_equipped_HAT% placeholder. It return true if player has a hat, false if not.

conditions:
  nametagNormal:
    conditions:
    - '%magicosmetics_equipped_HAT%=false'
    true: '%vault-prefix%%player%%vault-suffix%'
    false: ""
  nametagHat:
    conditions:
    - '%magicosmetics_equipped_HAT%=true'
    true: '%vault-prefix%%player%%vault-suffix%'
    false: ""

Let's use it in groups.yml

_DEFAULT_:
  nametagNormal: "%condition:nametagNormal%"
  nametagHat: "%condition:nametagHat%"

Obviously don't forget to add your tabprefix and stuff. If you are using abovename and/or belowname as well, do the same for those lines as well. We already created static lines for them, let's create conditions for them.

conditions:
  nametagNormal:
    conditions:
    - '%magicosmetics_equipped_HAT%=false'
    true: '%vault-prefix%%player%%vault-suffix%'
    false: ""
  nametagHat:
    conditions:
    - '%magicosmetics_equipped_HAT%=true'
    true: '%vault-prefix%%player%%vault-suffix%'
    false: ""
  abovenameNormal:
    conditions:
    - '%magicosmetics_equipped_HAT%=false'
    true: 'abovename text'
    false: ""
  abovenameHat:
    conditions:
    - '%magicosmetics_equipped_HAT%=true'
    true: 'abovename text'
    false: ""
  belownameNormal:
    conditions:
    - '%magicosmetics_equipped_HAT%=false'
    true: 'belownametext'
    false: ""
  belownameHat:
    conditions:
    - '%magicosmetics_equipped_HAT%=true'
    true: 'belowname text'
    false: ""

and use in groups.yml

_DEFAULT_:
  nametagNormal: "%condition:nametagNormal%"
  nametagHat: "%condition:nametagHat%"
  abovenameNormal: "%condition:abovenameNormal%"
  abovenameHat: "%condition:abovenameHat%"
  belownameNormal: "%condition:belownameNormal%"
  belownameHat: "%condition:belownameHat%"

If you are not using all 3 lines, you can also remove them from static lines. You may also need to adjust static height, since you may want different height of the prefix+name+suffix line based on if you have belowname or not, to avoid the line being too high.

Displaying AFK status in tablist

First, you'll need to find a PlaceholderAPI placeholder for your AFK plugin in their documentation, such as

  • %essentials_afk% for Essentials
  • %cmi_user_afk_symbol% for CMI
  • %purpur_player_afk% for Purpur (server software)

Don't forget to install PlaceholderAPI and the respective expansion of your afk plugin.

Then, use the placeholder in configuration wherever you want it. Assuming you want it for all players, use _DEFAULT_ group keyword in groups.yml for default settings for all groups. Combined with other settings, it may look like this for tabsufffix:

_DEFAULT_:
  tabsuffix: "%luckperms-suffix%%essentials_afk%"

Or running an in-game command: /tab group _DEFAULT_ tabsuffix %luckperms-suffix%%essentials_afk%.
This is not limited to displaying AFK status in suffix, you can also using it in tabprefix instead (or nametags).

Finally, you will most likely need to set up placeholder output replacements for the placeholder, as lots of them, including the %essentials_afk% placeholder used as an example, return yes and no values, which you most likely want to customize. An example customization may look like this:

placeholder-output-replacements:
  "%essentials_afk%":
    "yes": " &4&lAFK"
    "no": "" # display nothing if not afk

To find out what does a placeholder return exactly, use /tab parse <player> <AFK placeholder> and then use the output in replacements (including colors).
Keep in mind that some placeholders don't need this. For example CMI has 2 placeholders - %cmi_user_afk% that returns true/false, and %cmi_user_afk_symbol% that returns AFK text configured in CMI configuration. Therefore, if you decide to use the latter one, you don't need to set up replacements.

Clone this wiki locally