[NMS] Change Player NameTag not work!

Discussion in 'Plugin Development' started by zDubsCrazy, Jul 20, 2014.

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

    zDubsCrazy

    This code not work, and I wanted to know why ... In the error says EntityHuman not have the field 'name'.

    Code:java
    1. try {
    2. Field name = EntityHuman.class.getDeclaredField("name");
    3. name.setAccessible(true);
    4. name.set(((CraftPlayer)p).getHandle(), args[0]);
    5. for(Player online : Bukkit.getOnlinePlayers()) {
    6. if(online.getName() != p.getName()) {
    7. ((CraftPlayer)online).getHandle().playerConnection.sendPacket(new PacketPlayOutNamedEntitySpawn(((CraftPlayer)p).getHandle()));
    8. }
    9. }
    10.  
    11. } catch(Exception e) {
    12. e.printStackTrace();
    13. }
     
Thread Status:
Not open for further replies.

Share This Page