Solved DELETE

Discussion in 'Spigot Plugin Development' started by TheBlackTeddy, Apr 27, 2017.

  1. DELETE
     
    #1 TheBlackTeddy, Apr 27, 2017
    Last edited: Jan 22, 2021
  2. 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);
                        }
                    }
                }
            });
     
  3. Mas

    Mas

    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.
     
    • Agree Agree x 1
  4. Have you tried to spell it onPacketSending instead of onpacketSending
     
    • Winner Winner x 1