Paper: ItemMeta#getLore() removing purple colour codes.

Created on 6 Apr 2020  路  5Comments  路  Source: PaperMC/Paper

What behaviour is expected:

___What you expected to see___
The purple colour code in the lore.

What behaviour is observed:

___What you actually saw___
The purple colour code was removed.

Steps/models to reproduce:

___This may include a build schematic, a video, or detailed instructions to help reconstruct the issue___
ItemMeta itemMeta = Bukkit.getItemFactory().getItemMeta(Material.DIAMOND_SWORD); List<String> lore = new ArrayList<>(); lore.add(ChatColor.translateAlternateColorCodes('&', "fasfdsfsa")); lore.add(ChatColor.translateAlternateColorCodes('&', "fasdfsa")); lore.add(ChatColor.translateAlternateColorCodes('&', "gfgagsgsg")); lore.add(ChatColor.translateAlternateColorCodes('&', "&5&lEnder I")); itemMeta.setLore(lore); new BukkitRunnable() { @Override public void run() { for (Player player : Bukkit.getOnlinePlayers()) { for (String string : itemMeta.getLore()) { player.sendMessage(string); } } } }.runTaskTimer(this, 50L, 50L);
^in your on enable.

Plugin list:

___A list of your plugins___
Citizens, CrateReloaded, ESBosses, ESChallenges, ESCombat2, ESDimensions, Essentials, EssentialsGeoIP, EssentialsProtect, EssentialsSpawn, FastAsyncWorldEdit, Phytomining, ShopGUIPlus, SkyblockNPCs, Vault, ViaBackwards, ViaRewind, ViaVersion, WorldEdit, WorldGuard

Paper build number:

___This can be found by running /version on your server. latest is not a proper version number; we require the output of /version so we can properly track down the issue.___
This server is running Paper version git-Paper-162 (MC: 1.15.2)

Anything else:

___Anything else you think may help us resolve the problem___
Look at how getLore() is implemented?

stale bug spigot 1.15

All 5 comments

Seems this is due to how Spigot implemented setLore, but we may be able to fix it.

Disregard the previous comment, it was not correct.

Afaik. this is necessary in order to not return a purple string when you add a string without color codes to the lores due how translating to chat components work currently. Changing this without keeping the non-colored strings non-colored on return would break backwards compatibility with plugins that might rely on the exact string getting returned that they added to the lore.

Firstly, it used to work on 1.13.2 (I just updated from that version) so it must be a relatively new bug, and secondly by default they have &5&o on the items lore, so just remove the &5&o rather than the &5 &o individually? Although to be fair, I haven't seen the implementation, so I might be misunderstanding it.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed because it has not had activity in a long time. If the issue still applies to the most recent supported version, please open a new issue referencing this original issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

successed picture successed  路  3Comments

zedwick picture zedwick  路  3Comments

TNTUP picture TNTUP  路  3Comments

Marlej-dev picture Marlej-dev  路  3Comments

molor picture molor  路  3Comments