setDisplayName does not work

Discussion in 'Spigot Plugin Development' started by Veldyaev2013, Sep 14, 2019.

  1. Code (Java):
     @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event)
        {
            Player player = event.getPlayer();
            String name = player.getName();
         
            player.setDisplayName(ChatColor.GRAY + name);
            player.setPlayerListName(ChatColor.GRAY + name);
    }
    Only setPlayerListName works