Solved OpenSignEditor packet kicks player

Discussion in 'Spigot Plugin Development' started by DePianoman, Jul 18, 2021.

Thread Status:
Not open for further replies.
  1. For my plugin I'm trying to go about showing text in a sign to a player through ProtocolLib, and I've seen I need to send a BlockChange event to place the sign followed by a packet to open the sign editor from the server to the client.

    The BlockChange is working just fine, but the OpenSignEditor packet isn't, and it crashes with this error.
    [​IMG]

    Here's my code for opening the sign (this.blockLocation is a Location for the sign and this.p is the Player):
    Code (Java):
    public void open() {
        PacketContainer blockChange = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.BLOCK_CHANGE);
        blockChange.getBlockPositionModifier().write(0, new BlockPosition(this.blockLocation.toVector()));
        blockChange.getBlockData().write(0, WrappedBlockData.createData(Material.SIGN_POST, 0));
        try {
            ProtocolLibrary.getProtocolManager().sendWirePacket(this.p, WirePacket.fromPacket(blockChange));
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }

        PacketContainer openSign = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.OPEN_SIGN_EDITOR);
        openSign.getBlockPositionModifier().write(0, new BlockPosition(this.blockLocation.toVector()));
        try {
            ProtocolLibrary.getProtocolManager().sendWirePacket(this.p, WirePacket.fromPacket(openSign));
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
    If anyone needs any more information then I'd be glad to supply
     
  2. I have solved my initial post by changing sendWirePacket to sendServerPacket.
     
Thread Status:
Not open for further replies.