Skript: Saving items with black-colored lore is buggy (restart will remove the '&0')

Created on 20 May 2020  路  7Comments  路  Source: SkriptLang/Skript

Issue:
Saving an item with black colored lore will be reset after server restart.

Versions:

  • Loading Skript v2.5-alpha3
  • This server is running Tuinity version git-Tuinity-"5cf4104" (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)

Skript for testing it yourself:

function updateslotitem(count: integer, p: player):
    #set {_newitem} to stone named "&2Teststein" with lore "&5Testlore!"
    set {_newitem} to {_p}'s tool
    set {testgui::slot::%{_count}%::item} to {_newitem}
    send "done." to {_p}    


command /test3:
    permission: skript.perm.mod
    trigger:
        #message "%all worldguard flags of test%"
        set {_p} to the player
        open virtual chest with 5 rows named "Testgui" to {_p}
        set {_count} to 0
        set {_testitem} to APPLE named "&2Test" with lore "&eTestlore1", "&4Testlore2" and "&2Testlore3"
        loop 45 times:
            if {testgui::slot::%{_count}%::item} is not set:
                make a gui slot {_count} of {_p} with {_testitem} to run function updateslotitem({_count},{_p}) using "left" click
            else:
                make a gui slot {_count} of {_p} with {testgui::slot::%{_count}%::item} to run function updateslotitem({_count},{_p}) using "left" click
            add 1 to {_count}

How to reproduce:

Use my skript above. Take a stone or whatever in your main hand, give it a lore like shown in the screenshot (e.g. &0My Lore). Open the gui and leftlick on any slot. Open the gui again and see that the item's lore is black (=correct).
https://i.imgur.com/jXv5sht.png

Now restart your server and open the gui again and you will notice the black colored lore line is no longer black. It magically changed.
https://i.imgur.com/zsShthW.png

invalid

Most helpful comment

Yes, just apparently no one noticed this til now. Probably because NO ONE uses black in item names or lore because they're nearly impossible to see.

All 7 comments

1) When reporting bugs and posting reproducible code, please put code that does not require addons. Luckily I happen to have Tuske on my test server, but others may not have this. The dev team shouldn't be required to download addons to test issues with Skript.
On that note, all this testing could be down with a heck of a lot simpler code. Reproducible code should be simple and to the point, without a bunch of redundant steps (ie: the GUI), please keep this in mind for future bug reports.

2) I was able to reproduce this via a lot simpler code:
In my tester, I gave myself an item with 3 colors in the lore, black green and blue.
I then sent a message including the lore:
Screen Shot 2020-05-20 at 2 43 53 AM
You can see here the lore is black

I then restarted my server and sent the same code, which the black part turned white:
Screen Shot 2020-05-20 at 2 43 32 AM

This is definitely an odd bug.
Im marking this as a low priority bug since this is not harmful to the standard experience. But I do feel like this needs to be fixed.

Ok, after further investigation I have come to realize this is NOT a Skript bug, but rather a Spigot (or Paper) bug.

On my other test server, not related to Skript, I created the same item and save it to YAML
this was the result

item:
  ==: org.bukkit.inventory.ItemStack
  v: 2230
  type: STONE
  meta:
    ==: ItemMeta
    meta-type: UNSPECIFIC
    lore:
    - BLACK
    - 搂aGREEN
    - 搂bBLUE

As you can see, the color code for BLACK does not save, but the other colors do save.

I have reported this to Spigot, the issue can be found here:
https://hub.spigotmc.org/jira/browse/SPIGOT-5749

Thanks for your effort ShaneBeee!

But if this is a paper / spigot bug it must have been existed for long time. Tested a paper build from march with my skript and it's the same issue with this old version.

Yes, just apparently no one noticed this til now. Probably because NO ONE uses black in item names or lore because they're nearly impossible to see.

This has now been fixed in CraftBukkit/Spigot
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/cfeef75cd979c5d2b408645909325a055376c520

Just a heads up, if you are using Paper, it might take them a day or two to update from upstream.
Update:
This has now also been fixed in Paper in the latest update Paper#322

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Anarchick picture Anarchick  路  3Comments

Snow-Pyon picture Snow-Pyon  路  4Comments

Romitou picture Romitou  路  3Comments

Coolfire02 picture Coolfire02  路  3Comments

GiraffeCubed picture GiraffeCubed  路  3Comments