2012-06-15 52 views
1

我一直在研究一個涉及Steam Condenser的小項目,這是一個使用Java編寫的Steam API,但是我一直無法用它做任何事情。蒸汽冷凝器java錯誤

我會解釋一下。這就是wiki告訴我:

SteamId id = new SteamId("demomenz");

GameStats stats = id.getGameStats("tf2");

List achievements = stats.getAchievements();

的問題是,Eclipse不喜歡它顯然,因爲它吐出了這個錯誤:

The constructor SteamId(String) is undefined

,這讓我改變它的選項於:

SteamId id = new SteamId("demomenz", false);

但在這一點上不同的錯誤出來:

The constructor SteamId(Object, boolean) is not visible

所以,我假設這個函數是API的內部函數,不應該從外部調用。

如果有人熟悉這一點,或者有線索說明我爲什麼會遇到這個錯誤(我對Java開發相當陌生),我們將不勝感激。

UPDATE:

The constructor SteamId(String) is undefined

這是如果使用SteamId.create(ConvertedID); (ConvertedID是一個包含Steam64 ID的字符串)。

在這一點上,我相信這個API是不是寫得很好,至少對於Java。任何其他想法?

+2

來自github上的源代碼,它看起來像維基正在撒謊,並且調用應該是'SteamId.create(「demomenz」)' – Thomas

+0

我剛更新了OP。 – Damian

+0

你仍然遇到這個問題嗎? – Koraktor

回答

1

它看起來像構造函數是私人的。用這個代替:

SteamId id = SteamId.create("demomenz"); 
+0

沒有工作,你可以看看更新的OP? – Damian

1

使用他們的靜態方法來創建流ID嘗試:

我看到下面的方法的API中

/** 
* Creates a new <code>SteamID</code> instance or gets an existing one 
* from the cache for the profile with the given ID 
* 
* @param id The 64bit SteamID of the player 
* @return The <code>SteamId</code> instance of the requested profile 
* @throws SteamCondenserException if the Steam ID data is not available, 
*   e.g. when it is private 
*/ 
public static SteamId create(String id) 
     throws SteamCondenserException { 
    return SteamId.create((Object) id, true, false); 
} 

用法是:

SteamId streamId = SteamId.create("myId"); 
+0

沒有工作,你可以看看更新的OP? – Damian