From 975fa80b0c24fcc16692eb547cba30095500cfe0 Mon Sep 17 00:00:00 2001 From: HacktheTime Date: Thu, 22 Aug 2024 19:59:47 +0200 Subject: [PATCH 1/6] added Garden API Path --- .../main/java/net/hypixel/api/HypixelAPI.java | 10 ++++++++ .../reply/skyblock/SkyBlockGardenReply.java | 24 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockGardenReply.java diff --git a/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java b/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java index 942cf1b9..f8c7cde0 100644 --- a/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java +++ b/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java @@ -208,6 +208,16 @@ public CompletableFuture getPetRepository() { .thenApply(PetRepositoryImpl::new); } + /** + * @param profile Profile ID of which you are requesting the Garden for. + * @return the future + */ + public CompletableFuture getSkyBlockGarden(String profile) { + return get(true, SkyBlockGardenReply.class, "skyblock/garden", + HTTPQueryParams.create() + .add("profile", profile) + ); + } public CompletableFuture getSkyBlockProfile(String profile) { return get(true, SkyBlockProfileReply.class, "skyblock/profile", HTTPQueryParams.create() diff --git a/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockGardenReply.java b/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockGardenReply.java new file mode 100644 index 00000000..3367fa97 --- /dev/null +++ b/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockGardenReply.java @@ -0,0 +1,24 @@ +package net.hypixel.api.reply.skyblock; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import net.hypixel.api.reply.RateLimitedReply; + +public class SkyBlockGardenReply extends RateLimitedReply { + private JsonElement garden; + + public JsonObject getGarden() { + if (garden == null || garden.isJsonNull()) { + return null; + } else { + return garden.getAsJsonObject(); + } + } + + @Override + public String toString() { + return "SkyBlockGardenReply{" + + "profile=" + garden + + "} " + super.toString(); + } +} From 376dff6b96ba23b5ffd432784239c445bd3127ae Mon Sep 17 00:00:00 2001 From: HacktheTime Date: Wed, 4 Sep 2024 09:00:23 +0200 Subject: [PATCH 2/6] added Museum API Path --- .../main/java/net/hypixel/api/HypixelAPI.java | 12 ++++++++++ .../reply/skyblock/SkyBlockMuseumReply.java | 24 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java diff --git a/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java b/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java index f8c7cde0..37f7784b 100644 --- a/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java +++ b/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java @@ -218,6 +218,18 @@ public CompletableFuture getSkyBlockGarden(String profile) .add("profile", profile) ); } + + /** + * @param profile Profile ID of which you are requesting the Museum for. + * @return the future + */ + public CompletableFuture getSkyblockMuseum(String profile) { + return get(true, SkyBlockMuseumReply.class, "skyblock/museum", + HTTPQueryParams.create() + .add("profile", profile) + ); + } + public CompletableFuture getSkyBlockProfile(String profile) { return get(true, SkyBlockProfileReply.class, "skyblock/profile", HTTPQueryParams.create() diff --git a/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java b/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java new file mode 100644 index 00000000..6950c78a --- /dev/null +++ b/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java @@ -0,0 +1,24 @@ +package net.hypixel.api.reply.skyblock; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import net.hypixel.api.reply.RateLimitedReply; + +public class SkyBlockMuseumReply extends RateLimitedReply { + private JsonElement museum; + + public JsonObject getGarden() { + if (museum == null || museum.isJsonNull()) { + return null; + } else { + return museum.getAsJsonObject(); + } + } + + @Override + public String toString() { + return "SkyBlockMuseumReply{" + + "profile=" + museum + + "} " + super.toString(); + } +} From 56fa07f33352f5d27c11ba27fee5afddca8a9859 Mon Sep 17 00:00:00 2001 From: HacktheTime Date: Thu, 5 Sep 2024 18:51:29 +0200 Subject: [PATCH 3/6] fixed method name saying getGarden instead of getMuseum --- .../net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java b/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java index 6950c78a..ae56a9a4 100644 --- a/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java +++ b/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java @@ -7,7 +7,7 @@ public class SkyBlockMuseumReply extends RateLimitedReply { private JsonElement museum; - public JsonObject getGarden() { + public JsonObject getMuseum() { if (museum == null || museum.isJsonNull()) { return null; } else { From 85d537d149af96298bd26f29dea941e17573fe0c Mon Sep 17 00:00:00 2001 From: HacktheTime Date: Thu, 5 Sep 2024 22:25:47 +0200 Subject: [PATCH 4/6] possible bug fix for museum --- .../hypixel/api/reply/skyblock/SkyBlockMuseumReply.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java b/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java index ae56a9a4..137477f9 100644 --- a/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java +++ b/hypixel-api-core/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockMuseumReply.java @@ -5,20 +5,20 @@ import net.hypixel.api.reply.RateLimitedReply; public class SkyBlockMuseumReply extends RateLimitedReply { - private JsonElement museum; + private JsonElement members; public JsonObject getMuseum() { - if (museum == null || museum.isJsonNull()) { + if (members == null || members.isJsonNull()) { return null; } else { - return museum.getAsJsonObject(); + return members.getAsJsonObject(); } } @Override public String toString() { return "SkyBlockMuseumReply{" + - "profile=" + museum + + "profile=" + members + "} " + super.toString(); } } From fc46aefea5a3eb815c5afca5f6f6979a2a92921c Mon Sep 17 00:00:00 2001 From: hackthetime Date: Wed, 15 Jul 2026 09:22:30 +0200 Subject: [PATCH 5/6] added reosurcepack api like for skyblock --- .../main/java/net/hypixel/api/HypixelAPI.java | 5 ++ .../hypixel/api/reply/ResourcePackReply.java | 59 +++++++++++++++++++ .../net/hypixel/api/util/ResourceType.java | 2 +- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 hypixel-api-core/src/main/java/net/hypixel/api/reply/ResourcePackReply.java diff --git a/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java b/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java index 37f7784b..06bd1f66 100644 --- a/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java +++ b/hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java @@ -161,6 +161,11 @@ public CompletableFuture getCounts() { return get(true, CountsReply.class, "counts"); } + public CompletableFuture getResourcePacks() { + return get(false, ResourcePackReply.class, "resources/packs",null, 5L); + } + + /** * Gets the current status of the player with information about the server they are in * at that moment. diff --git a/hypixel-api-core/src/main/java/net/hypixel/api/reply/ResourcePackReply.java b/hypixel-api-core/src/main/java/net/hypixel/api/reply/ResourcePackReply.java new file mode 100644 index 00000000..fcf0c2cf --- /dev/null +++ b/hypixel-api-core/src/main/java/net/hypixel/api/reply/ResourcePackReply.java @@ -0,0 +1,59 @@ +package net.hypixel.api.reply; + +import com.google.gson.JsonObject; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.Comparator; +import java.util.List; +import java.util.UUID; + +public class ResourcePackReply extends AbstractReply { + List packs; + + /** + * Convenience function. + * @return Skyblock Resource Pack. + * @throws IllegalAccessException if no resourcepack with the configured id is found. + */ + ResourcePack getSkyblockPack() throws IllegalAccessException { + return packs.stream().filter(a -> a.gameId.equals("SkyBlock")).findFirst().orElseThrow(()->new IllegalAccessException("SkyBlock pack not found")); + } + + + static class ResourcePack { + /** + * For example "SkyBlock" + */ + String gameId; + Long lastUpdated; + UUID deployUUID; + List versions; + public VersionResourcePack latest(){ + return versions.stream().max(Comparator.comparingInt(a -> a.packFormat)).orElse(null); + } + } + + static class VersionResourcePack { + /** + * These are the mc packformats used. + */ + int packFormat; + String url; + String hash; + + /** + * Downloads the file from the download url to the specified file. Note that this is a Zip Archive! + */ + public void downloadToFile(File file) throws IOException { + URL url = new URL(this.url); + try (InputStream in = url.openStream()) { + Files.copy(in, Paths.get(file.getAbsolutePath()), StandardCopyOption.REPLACE_EXISTING); + } + } + } +} diff --git a/hypixel-api-core/src/main/java/net/hypixel/api/util/ResourceType.java b/hypixel-api-core/src/main/java/net/hypixel/api/util/ResourceType.java index 66fa34ab..fe1399a7 100644 --- a/hypixel-api-core/src/main/java/net/hypixel/api/util/ResourceType.java +++ b/hypixel-api-core/src/main/java/net/hypixel/api/util/ResourceType.java @@ -13,7 +13,7 @@ public enum ResourceType { SKYBLOCK_ITEMS("skyblock/items"), SKYBLOCK_ELECTION("skyblock/election"), SKYBLOCK_BINGO("skyblock/bingo"), - ; + RESOURCE_PACKS("resourcepacks"),; /** * Path to resource From f6f17ad251454ae6651a3270b1d433443563de6d Mon Sep 17 00:00:00 2001 From: HacktheTime Date: Fri, 17 Jul 2026 01:18:18 +0200 Subject: [PATCH 6/6] fixed missing public for resourcepack fields --- .../hypixel/api/reply/ResourcePackReply.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/hypixel-api-core/src/main/java/net/hypixel/api/reply/ResourcePackReply.java b/hypixel-api-core/src/main/java/net/hypixel/api/reply/ResourcePackReply.java index fcf0c2cf..2ba957e5 100644 --- a/hypixel-api-core/src/main/java/net/hypixel/api/reply/ResourcePackReply.java +++ b/hypixel-api-core/src/main/java/net/hypixel/api/reply/ResourcePackReply.java @@ -1,6 +1,5 @@ package net.hypixel.api.reply; -import com.google.gson.JsonObject; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -13,38 +12,38 @@ import java.util.UUID; public class ResourcePackReply extends AbstractReply { - List packs; + public List packs; /** * Convenience function. * @return Skyblock Resource Pack. * @throws IllegalAccessException if no resourcepack with the configured id is found. */ - ResourcePack getSkyblockPack() throws IllegalAccessException { + public ResourcePack getSkyblockPack() throws IllegalAccessException { return packs.stream().filter(a -> a.gameId.equals("SkyBlock")).findFirst().orElseThrow(()->new IllegalAccessException("SkyBlock pack not found")); } - static class ResourcePack { + public static class ResourcePack { /** * For example "SkyBlock" */ - String gameId; - Long lastUpdated; - UUID deployUUID; - List versions; + public String gameId; + public Long lastUpdated; + public UUID deployUUID; + public List versions; public VersionResourcePack latest(){ return versions.stream().max(Comparator.comparingInt(a -> a.packFormat)).orElse(null); } } - static class VersionResourcePack { + public static class VersionResourcePack { /** * These are the mc packformats used. */ - int packFormat; - String url; - String hash; + public int packFormat; + public String url; + public String hash; /** * Downloads the file from the download url to the specified file. Note that this is a Zip Archive!