Lockable Container Keys With Colored Names Do Not Work

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • Environment:

      Mac OS

    • git-Spigot-ff439d1-ff2b944 (MC: 1.16.4)
    • Yes

      Creating a key item that will unlock a Lockable Chest no longer seems to be possible if the key name has ChatColor codes in it. I think this is because the meta display name is now a chat component, but locks are simple strings.

      I have a test plugin here: https://github.com/NathanWolf/Bukkit-Unit-Tests/releases/tag/lockable

      This plugin sets a lock on a chest to the same string as an item's display name, with a red color prefix.

      I used the /data command to compare the Lock tag on the block versus the NBT display name data on the item, it looks something like this:

      {"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"red","text":"KEY"}],"text":""}
      

      But the chest data just has this:

      {x: 4715, y: 63, z: -4619, Items: [], id: "minecraft:chest", Lock: "§cKEY"}

       

      If a string with no color codes is used, it works fine- I'm not sure why though since inspecting the item still yields a JSON representation such as

      {"extra":[{"text":"KEY"}],"text":""}
      

      but the lock tag is just "KEY".

      Is there some logic already for comparing the JSON to the old-style string?

      I'm hoping this means it might be possible to fix the colored case as well, I will add any info I find if I can dig further.

       

            Assignee:
            Unassigned
            Reporter:
            Nathan Wolf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: