Featherboard - Can I have conditional lines?

Discussion in 'Spigot Plugin Help' started by devJordan, Apr 18, 2020.

  1. So I have Towny and Featherboard on my server, I want to display the town name that the user is in on the scoreboard, but with the placeholder for the towny town name there, even if the player is not in a town the place holder is still there, it just says "Town Name:", obviously because there is more than just the placeholder in that line.

    TL;DR: So is there a way to make a line conditional so that it doesn't show unless the player is actually in a town?
  2. Yes! You can.
    First, you need to use a "frame", to be more exact this frame:
    Code (Text):
    - '|visible:true|Test'
    This will allow you to set the visibility of the line more dynamically.

    Secondly, you will need an effect to test if the town is empty or has a name:
    Code (Text):
    <whennotequal test1="abc" test2="abc">Its equal</whenequal>
    If you combine this two, you will have the result you want:

    Code (Text):
    - '|visible:<whennotequal test1="{PLACEHOLDER_TOWN}" test2=" ">true</whenequal>|Town: {PLACEHOLDER_TOWN}'
    However, you can try a different approach, like displaying "No town", where there is no town.

    Code (Text):
    - 'Town: <whenempty value="{PLACEHOLDER_TOWN}">No town</whenempty> {PLACEHOLDER_TOWN}'
    Effects: https://www.spigotmc.org/wiki/mvdw-effects/
    Frames: https://www.spigotmc.org/wiki/featherboard-configuration/#frames