koraktor / steam-condenser

A multi-language library for querying the Steam Community, Source, GoldSrc servers and Steam master servers
https://koraktor.de/steam-condenser
Other
356 stars 67 forks source link

Java: GoldSrcServer.getPlayers() returns map with SteamPlayers having null SteamID #296

Closed realbucksavage closed 8 years ago

realbucksavage commented 8 years ago

I am trying to get the SteamID of players on a counter-strike server. I am using the following code:-

List<Server> activeServers = serverDao.getActiveServers();

GameServer gameServerObject = null;

for (Server server : activeServers) {

    gameServerObject = gameServerBA.getGameServerObject(server);

    try {

        Map<String, SteamPlayer> players = gameServerObject.getPlayers();

    } catch (SteamCondenserException e) {

        e.printStackTrace();

    } catch (TimeoutException e) {

        e.printStackTrace();

    }

}

Everything is fine, but the SteamPlayers in the Map have null SteamID.

P.S.:- gameServerBA.getGameServerObject() returns an instance of GoldSrcServer.

koraktor commented 8 years ago

The SteamID can only be obtained using the enhanced getPlayers() that uses RCON.

To use it, you will have to know the RCON password of the server and pass it to getPlayers():

server.getPlayers(rconPassword);