[SPIGOT-6223] Ability to set BaseComponent/JSON as Prefix/Suffix for Scoreboard Team Created: 07/Nov/20  Updated: 31/Aug/22

Status: Open
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: Sasha Sorokin Assignee: Parker Hawke
Resolution: Unresolved Votes: 2
Labels: api
Environment:

Windows 10 running OpenJDK 1.8.0_272-b10 (openj9-0.23.0)


Attachments: PNG File image-2020-11-07-11-01-22-305.png    
Version: git-Spigot-57bbdd8-dea4138 (MC: 1.16.3) (Implementing API version 1.16.3-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

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.

 


Generated at Sat Apr 05 09:38:26 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.