[ProtocolLib] Changing Player Nametag

Discussion in 'Plugin Development' started by Code01, Apr 13, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Code01

    I have been looking for this for like... 1 week? I simply can't find an up to date version using ProtocolLib. So, I'd like some (aka ALOT) of help with this. Don't refrain from spoonfeeding. I'll then try to understand it myself.

    What I want to do:

    Make a plugin that upon the issuing of a command, stores the selected name in a weakhashmap (no memory leaks) and then upon all Named Entity Spawn packets changed the name tag.

    I can do the command etc, but I'm heavily struggling with the Packet Listening aka adapting.

    Version: 1.7.9 ProtocolLib 3.4.0

    Thanks in advance.
     
  2. Offline

    I Al Istannen

    @Code01 The last time i played with ProtocolLib (3.4.0) it was like this:
    Code:
    ProtocolManager manager;
    PacketListener listener;
    
      listener = new PacketAdapter(yourPlugin, ListenerPriority yourPriority, PacketType yourPacketType) {
        @Override
        public void onPacketReceiving(PacketEvent event) {
             //your stuff on packet Recieving
        }
     
        @Override
        public void onPacketSending(PacketEvent even1) {
          //your stuff on packet Sending   
        }
      };
    
      manager.addPacketListener(listener);
    
    You will probably need just sending or recieving.
    Sending and recieving are from the server side.
     
  3. Offline

    Code01

    @I Al Istannen I guess I didn't fully explain :p. My bad.

    I know how to create the "shell" for the listener, but I don't know a lot about the whole somevar.read(somenumber) (data). That is: I don't know how to modify the packet.
     
  4. Offline

    I Al Istannen

    Last edited: Apr 13, 2015
    Code01 likes this.
  5. Offline

    Code01

  6. Offline

    I Al Istannen

    @Code01 No problem, glad i could help ;)
     
    Code01 likes this.
Thread Status:
Not open for further replies.

Share This Page