Skip to content

Commit

Permalink
Use new providers.json
Browse files Browse the repository at this point in the history
  • Loading branch information
rtm516 committed Aug 31, 2024
1 parent 374c73f commit 4e26f79
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,16 @@ List<Provider> getProviders() {
}

// Fetch the search page
JSONObject contents = RestClient.get("https://raw.githubusercontent.com/GeyserMC/GeyserWiki/master/_data/providers.json").asJSONObject();
Map<String, Object> descriptionTemplates = contents.getJSONObject("description_templates").toMap();
JSONObject contents = RestClient.get("https://geysermc.org/data/providers.json").asJSONObject();

List<Provider> providers = new ArrayList<>();

for (String category : contents.keySet()) {
if (category.equals("description_templates")) continue;

JSONArray categoryProviders = contents.getJSONArray(category);
for (Object providerObj : categoryProviders) {
JSONObject provider = (JSONObject) providerObj;

String template = provider.has("description_template") ? descriptionTemplates.get(provider.getString("description_template")).toString() : "";
String description = String.format("%s %s", template, provider.optString("description", "")).trim();
String description = provider.getString("description").trim();

providers.add(new Provider(
provider.getString("name"),
Expand Down

0 comments on commit 4e26f79

Please sign in to comment.