1.15.2 ProtocolLib setting sign text doesn't work on placed sign until relog

Discussion in 'Spigot Plugin Development' started by Big_Bad_E, Feb 23, 2020.

  1. I edit the text of certain signs using ProtocolLib. The following code is called:
    Code (Text):
    PacketContainer container = event.getPacket();
            if (container.getIntegers().getValues().get(0) == 9) {
                NbtCompound compound = (NbtCompound) container.getNbtModifier().read(0);
                compound.put("Text3", "{\"extra\":[{\"text\":\"" + event.getPlayer().getInventory().getItemInMainHand().getType() + "\"}],\"text\":\"\"}");
                container.getNbtModifier().write(0, compound);
    This doesn't run on all signs obviously, just certain signs.
    Now, this works fine 99% of the time, but for some reason it won't work on first placed. At least one player has to relog, then it magically starts working. The code is called, it 100% writes the compound, yet the player doesn't see the changed sign.
    The weird thing is that everyone doesn't have to relog, just one person.