Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7648

Goat Horn NBT data should allow empty string value for "instrument"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version 4090-Spigot-b754dcc-38b1f49 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT)
    • Yes

      Hi,

       

      First of all, sorry if not opened in the correct project (might be build tools as this is more related to Craftbukkit itself).

       

      I'm trying to achieve the following : alter the NBT data of a goat horn to set the key tag "instrument" to an empty value.

       

      On Craftbukkit and Spigot : The client will just disconnect

       

      "Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: Input string must not be empty or null" 

      or

       

       

      Internal Exception: io.netty.handler.codec.EncoderException: java.lang.NullPointerException: Cannot invoke "org.bukkit.NamespacedKey.getNamespace()" because "key" is null 

       

       

      On PaperMC, which fork Spigot, we aren't kicked from the server, but the whole key "instrument" got removed from the NBT tags.

       

      On Vanilla server and Fabric, this behavior is working just fine.

       

      Why I need this ?

      ==> The need of an empty string value allow to have a goat horn that didn't emit any sound/music.

      Doing so, a plugin like Audio Player (Fabric) can play of specific audio file through Simple Voice Chat.

       

      I'm also willing to add the "player head" sound ability for Spigot/PaperMC, but didn't looked at it yet on how it work for Fabric.

       

       

      On my research, the error seems to be triggered by the class "NamespacedKey" / "org.bukkit.NamespacedKey.getNamespace()", and could also be related to this specific one too : "CraftMetaMusicInstrument.java".

       

       

      Here are some commands to reproduce the error :

       

      This command will work (instrument tag have a value, lowercase) :

       

      /give @p minecraft:goat_horn{HideFlags:255,instrument:"t",display:{Lore:['{"italic":false,"color":"gray","text":"TEXT"}']}}

       

      This one will fail (using an uppercase in the "instrument" key value)

      /give @p minecraft:goat_horn{HideFlags:255,instrument:"T",display:{Lore:['{"italic":false,"color":"gray","text":"TEXT"}']}} 

       

      And this one will fail (because empty "instrument" value) :

      /give @p minecraft:goat_horn{HideFlags:255,instrument:"",display:{Lore:['{"italic":false,"color":"gray","text":"TEXT"}']}} 

       

      PS : On Craftbukkit server, the command will always work (you get the horn), but as soon as you open the player inventory or run the below command (with the goat horn in your main hand), you'll be disconnected :

      /data get entity @s SelectedItem 

            Unassigned Unassigned
            Athar42 Athar42
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: