public static void setNte(Player p,String name) {
EntityHuman ent = ((CraftPlayer)p).getHandle();
Field pname= null;
try {
pname = ent.getClass().getSuperclass().getDeclaredField("bH");
pname.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.set(pname,pname.getModifiers() & ~Modifier.FINAL);
pname.set(ent, new GameProfile(p.getUniqueId(),ChatColor.translateAlternateColorCodes('&',name)));
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
Bukkit.getConsoleSender().sendMessage("Error changing nte for:"+p.getCustomName());
e.printStackTrace();
}
}