0

i am trying to do small Application to work with my Team in steam and i have use the jave Implementation suggest in steam ,"Steam Condenser" .

So I have try getting Player information like ,

    SteamId id = SteamId.create("XXXXXXXXXX");

    String avatar_url = id.getAvatarMediumUrl();
    String avatar_name = id.getNickname();


    System.out.println(avatar_name);
    System.out.println(avatar_url); 

    SteamId[] friend = id.getFriends();
    for(int i =0 ; i<friend.length;i++)
    {
        fr = friend [i];
        //where null is in
        System.out.println(fr.getNickname());
    }

But when i run it it give me right Avator name,Url,etc but for Friend list I get all "null" (get right count of nulls).So whats the wrong?

and i cant see any other way or even other API or any other examples to send a message to a friend, but we all have face spam bots sending us message every day ,so how can we send a message to a friend .

Many thanks for all your help ......

Archangle
  • 312
  • 1
  • 4
  • 23
  • I assume that the `null`s you get are from `System.out.println(id.getNickname());`? If so, you'll need to look at the `getNickname()` method as well as what `SteamId.create` assigns nicknames to be. – Vitruvie Mar 05 '15 at 05:57
  • I bet you mean "message". But I could use a massage, too right now. :) – Fildor Mar 05 '15 at 05:58
  • @Saposhiente ,I am sorry, i was fix it in code. i was try few ways of doing it and add the wrong loop .now question is in right way with gives me nulls,Thanks for the help bro. – Archangle Mar 05 '15 at 06:14

1 Answers1

1

SteamId#fetchFriends() returns unfetched (i.e. empty) instances of SteamId for every friend. You will have to call #fetchData() on each of them first.

SteamId[] friends = id.getFriends();
for (int i = 0; i < friend.length; i++) {
    friend[i].fetchData(); // This will get the profile data of that friend
    System.out.println(friend[i].getNickname());
}

Please note that this will require an additionall HTTP request for every friend in the list.

Koraktor
  • 41,357
  • 10
  • 69
  • 99
  • Thanks for your answer Bro ,Is there anyway i can send a massage to a friend using your Project ? , And Thanks for your contribution for all steam Gamers :) . – Archangle Mar 05 '15 at 08:02
  • @Archangle: No sorry, there's no public API for this. You might want to try something like SteamKit2 for this. – Koraktor Mar 05 '15 at 09:01