Maybe write @Override over the onpacketSending method Code (Text): protManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, new PacketType[] { PacketType.Play.Server.TAB_COMPLETE }) { @SuppressWarnings("unused") @Override //<--- public void onpacketSending(PacketEvent e){ if ((e.getPacketType() == PacketType.Play.Server.TAB_COMPLETE)){ if(!e.getPlayer().hasPermission("SomePermission")){ e.setCancelled(true); } } } });
I'm pretty sure you don't need to check if e.getPacketType() == PacketType.WHATEVER, because you already specified in the PacketAdapter constructor that you wish to listen only to tab complete packets. That's because the method is onPacketSending, not onpacketSending. Case matters.