[SPIGOT-4043] ItemMeta - Different behavior with the § character (problem with numbers) Created: 18/Jul/18  Updated: 18/Jul/18  Resolved: 18/Jul/18

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

Type: Bug Priority: Minor
Reporter: F_o_F_1092 Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: Chat, ChatColor, ItemMeta

Attachments: File Test.jar    
Version: This server is running CraftBukkit version git-Spigot-83d9d09-65bc676 (MC: 1.13-pre7) (Implementing API version 1.13-pre7-R0.1-SNAPSHOT)

 Description   

Yesterday i've created this report with the § character problem:

https://hub.spigotmc.org/jira/browse/SPIGOT-4035

 

But i've noticed that this problem still exists with numbers:

 

1.13

 

String text = "TEST1234TEST";

String hiddenText = "";
for(char c : text.toCharArray()){
 hiddenText += "§" + c;
}

//String hiddenText = "§T§E§S§T§1§2§3§4§T§E§S§T";

ItemStack is = new ItemStack(Material.STONE);
ItemMeta itemMeta = is.getItemMeta();
itemMeta.setDisplayName(hiddenText);
is.setItemMeta(itemMeta);

Bukkit.broadcastMessage(hiddenText.replace("§", ""));
Bukkit.broadcastMessage(itemMeta.getDisplayName().replace("§", ""));

 



 Comments   
Comment by F_o_F_1092 [ 18/Jul/18 ]

The visual representation is the same.

 

But the difference is that the "§" character is not converted within the JSON text (In Vanilla).

/give @p minecraft:paper{display:{Name:"[{\"text\":\"\\u00A7a\\u00A7a Test\"}]"}} 1

 

 

 

 

I would assume that the current situation for "§a§a Test" is this (craftbukkit):
 

{"text":" Test","color":"green"}

 

But it would definitely make more sense if the first part wont be cut out if the String is converted into the JSON format:

{"text":"","color":"green"},{"text":" Test","color":"green"}

 

This won't cause any data loss and the result (for "itemMeta.getDisplayName().replace("§", "")") would be the same as in older versions.

 

Comment by gizmo [ 18/Jul/18 ]

can we have an api to replace this if it won't be fixed?

this feature is commonly used to store information on items and without it functioning as it used to there is no way to store information within ItemStacks.

Comment by md_5 [ 18/Jul/18 ]

Uppercase what?
You aren't being specific at all.

There is only a bug if the visual representation of the characters is different than what it is in Vanilla.

If this is the case you should show a precise example and comparison between craftbukkit and vanilla.

Comment by F_o_F_1092 [ 18/Jul/18 ]

Hmm, this method to save hidden informations on items has been used for a very log time, and it would make some parts a bit more difficult in the future... :/

 

It's also a bit confusing that uppercase characters are not converted in the same way as lowercase ones...

Comment by md_5 [ 18/Jul/18 ]

Won't fix.
The conversation to json only preserves visible appearance of text, it is not fully invertible.
If you are trying to stenograph messages you need to do it a different way.

Generated at Sat Dec 13 20:46:00 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.