Skip to content

Commit a6d2038

Browse files
Don't show plugins that aren't released yet. (#105)
* Don't show plugins that aren't released yet. * Remove unused import Co-authored-by: Christian <[email protected]>
1 parent 3937c2e commit a6d2038

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/main/kotlin/com/lambda/client/gui/mc/LambdaPluginSelectionList.kt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,19 @@ class LambdaPluginSelectionList(val owner: LambdaGuiPluginManager, mcIn: Minecra
7474
val jsonTree = JsonParser().parse(json).asJsonArray
7575

7676
jsonTree.forEach { jsonElement ->
77-
val name = jsonElement.asJsonObject.get("name").asString
78-
if (plugins.none { it.pluginData.name == name } &&
79-
loadedPlugins.none { it.name == name }) {
80-
plugins.add(LambdaPluginListEntry(owner, PluginData(name, PluginState.REMOTE, jsonElement.asJsonObject.get("description").asString)))
77+
val downloadsJson = ConnectionUtils.runConnection(jsonElement.asJsonObject.get("releases_url").asString.replace("{/id}", ""), { connection ->
78+
connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8")
79+
connection.requestMethod = "GET"
80+
connection.inputStream.readBytes().toString(Charsets.UTF_8)
81+
})
82+
83+
84+
if (JsonParser().parse(downloadsJson).asJsonArray.size() > 0) {
85+
val name = jsonElement.asJsonObject.get("name").asString
86+
if (plugins.none { it.pluginData.name == name } &&
87+
loadedPlugins.none { it.name == name }) {
88+
plugins.add(LambdaPluginListEntry(owner, PluginData(name, PluginState.REMOTE, jsonElement.asJsonObject.get("description").asString)))
89+
}
8190
}
8291
}
8392

0 commit comments

Comments
 (0)