BungeeTabListPlus icon indicating copy to clipboard operation
BungeeTabListPlus copied to clipboard

Add support for average TPS placeholder

Open cyberkitsune opened this issue 4 years ago • 1 comments

Currently the ${viewer server tps} placeholder resolves the server's instantaneous TPS. This can sometimes cause weird values (Like >20TPS) and very volatile values, like 20, then 11, then 20 all within seconds of eachother.

Can support be added for average TPS, such as the results of the /tps command?

Totally optional, colored output would be nice as an option too (green for >15, yellow for 10-15, red for <10 TPS)

cyberkitsune avatar Mar 20 '20 02:03 cyberkitsune

The built-in TPS placeholder is averaged over 2 seconds. If you prefer the values from Spigot's command you can use the placeholders provided by PlaceholderAPI for that.

You can use the custom placeholder mechanic to add color codes to the tps placeholder. Add the following custom placeholder:

customPlaceholders:
  # colored tps:
  # 0 - 12.5    -> red
  # 12.5 - 17.5 -> yellow
  # 17.5 - 20   -> green
  colored_tps0:
    !conditional
    condition: "${viewer server tps} < 12.5"
    true: "&c${viewer server tps}"
    false: "&e${viewer server tps}"
  colored_tps:
    !conditional
    condition: "${viewer server tps} < 17.5"
    true: "${colored_tps0}"
    false: "&a${viewer server tps}"

Then use ${colored_tps} to display the tps.

CodeCrafter47 avatar Mar 22 '20 10:03 CodeCrafter47