PacketPlayOutTabComplete

Discussion in 'Spigot Plugin Development' started by Bear53, Jun 3, 2016.

  1. I have this to block the /<tab> but it blocks every tab completion in game, is there a way to detect if its just /<tab> or not
    Code (Text):
    private void create(Player player) {
            cache.add(player.getUniqueId());
            ChannelDuplexHandler channelDuplexHandler = new ChannelDuplexHandler() {
                @Override
                public void channelRead(ChannelHandlerContext context, Object packet)
                        throws Exception {
                    super.channelRead(context, packet);
                }

                @Override
                public void write(ChannelHandlerContext context, Object packet,
                        ChannelPromise channelPromise) throws Exception {
                    if (packet instanceof PacketPlayOutTabComplete) {
                        PacketPlayOutTabComplete info = (PacketPlayOutTabComplete) packet;
                        return;
                    }
                    super.write(context, packet, channelPromise);
                }
            };

            ChannelPipeline pipeline = ((CraftPlayer) player).getHandle().playerConnection.networkManager.channel
                    .pipeline();
            pipeline.addBefore("packet_handler", player.getName(),
                    channelDuplexHandler);
        }
     
    • Optimistic Optimistic x 1
  2. I don't think there is a way to detect it unless you override the onTabComplete method in the main plugin class. BUT, the option "tab-complete" in the spigot.yml file can disable the /<tab> But still allows tab completion if the part of a command is typed out (I think). Set that option to -1 in spigot.yml and that should do it.