Anyone know why the won't work?

Discussion in 'Plugin Development' started by JackSparrrow, Mar 2, 2015.

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

    JackSparrrow

    Anyone know why the won't work?
    Code:
    PacketPlayOutNamedEntitySpawn packetPlayOutNamedEntitySpawn = new PacketPlayOutNamedEntitySpawn(((CraftPlayer) player).getHandle());
             
                try {
                    Field b = packetPlayOutNamedEntitySpawn.getClass().getDeclaredField("b");
                    b.setAccessible(true);
                    b.set(packetPlayOutNamedEntitySpawn, new GameProfile(player.getUniqueId(), "test"));
                } catch (Exception exception) {
                    exception.printStackTrace();
                }
             
                ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutNamedEntitySpawn);
    thanks

    EDIT: I'm trying to change the player's nametag
     
  2. Offline

    Skionz

  3. Offline

    JackSparrrow

  4. Offline

    Skionz

  5. Offline

    JackSparrrow

    Ohh, okay. How would I go about doing it then?
     
  6. Offline

    Skionz

    @JackSparrrow I'm not sure what each field is for. Just create a new EntityHuman instance with the properties you like.
     
Thread Status:
Not open for further replies.

Share This Page