Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6223

Ability to set BaseComponent/JSON as Prefix/Suffix for Scoreboard Team

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • Windows 10 running OpenJDK 1.8.0_272-b10 (openj9-0.23.0)

    • git-Spigot-57bbdd8-dea4138 (MC: 1.16.3) (Implementing API version 1.16.3-R0.1-SNAPSHOT)
    • Yes

      Minecraft allows prefixes, suffixes, objective titles to be in raw JSON format (except the ones requiring resolution), what can be tested by running these commands:

       

      /team add example_team {"text":"Unreal Team", "color": "#e7edc5"}
      
      /team modify example_team prefix { "text": "[Unreal Team] ", "color": "#e7edc5" }
      
      /team join example_team PlayerName
      
      /scoreboard objectives add objective dummy { "text": "S C O R E B O A R D", "bold": true, "italic": true, "color": "#e19fb9" }
      
      /scoreboard objectives setdisplay sidebar objective
      
      /scoreboard players set PlayerName objective 420
      

      Which would display the following scoreboard on screen:

       

       

      {{net.md_5.bungee.api.chat.* }}contains helpful classes to format text into this format. It makes sense you could use these classes (or at least their serialised values) with methods

      • org.bukkit.scoreboard.Team#setPrefix
      • org.bukkit.scoreboard.Team#setSuffix
      • org.bukkit.scoreboard.Team#setDisplayName
      • org.bukkit.scoreboard.Objective#setDisplayName

      Allowing this gives plugin creators simple ability to not only format texts (which already can be done using ChatColors API) but more valuable use client-side rendered texts, such as localised strings and keyboard shortcuts.

       

            2008Choco Parker Hawke
            RouhKeen Sasha Sorokin
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: