Skip to content
Permalink
Browse files

Add new methods for SkyBlock

  • Loading branch information
ConnorLinfoot committed Oct 10, 2019
1 parent 442c54f commit 357c62f6df181650afae28b72f215a6902cc0866
@@ -1,7 +1,8 @@
# session
**Note**: This method is deprecated and will be removed at a later date.

## Description
Returns session information for given player
Returns session information for given player.

## Parameters
- key
@@ -0,0 +1,7 @@
# skyblock/collections

## Description
Returns SkyBlock collections data, such as names, tiers and unlocks.

## Parameters
- key
@@ -0,0 +1,7 @@
# skyblock/news

## Description
Returns SkyBlock news, including a title, description and a thread.

## Parameters
- key
@@ -0,0 +1,8 @@
# skyblock/profile

## Description
Returns a SkyBlock profile's data, such as stats, objectives etc. The data returned can differ depending on the players in-game API settings.

## Parameters
- key
- profile _(Can be obtained via the player endpoint under `stats.SkyBlock`)_
@@ -0,0 +1,7 @@
# skyblock/skills

## Description
Returns SkyBlock skills data, such as names, levels and unlocks.

## Parameters
- key
@@ -0,0 +1,10 @@
package net.hypixel.example.skyblock;

import net.hypixel.example.ExampleUtil;

public class GetSkyBlockCollectionsExample {
public static void main(String[] args) {
ExampleUtil.API.getSkyBlockCollections().whenComplete(ExampleUtil.getTestConsumer());
ExampleUtil.await();
}
}
@@ -0,0 +1,10 @@
package net.hypixel.example.skyblock;

import net.hypixel.example.ExampleUtil;

public class GetSkyBlockNewsExample {
public static void main(String[] args) {
ExampleUtil.API.getSkyBlockNews().whenComplete(ExampleUtil.getTestConsumer());
ExampleUtil.await();
}
}
@@ -0,0 +1,24 @@
package net.hypixel.example.skyblock;

import com.google.gson.JsonElement;
import net.hypixel.example.ExampleUtil;

import java.util.Map;

public class GetSkyBlockProfileExample {
public static void main(String[] args) {
ExampleUtil.API.getPlayerByUuid(ExampleUtil.HYPIXEL).whenComplete((playerReply, throwable) -> {
if (throwable != null) {
throwable.printStackTrace();
System.exit(0);
return;
}

for (Map.Entry<String, JsonElement> profileEntry : playerReply.getPlayer().getAsJsonObject("stats").getAsJsonObject("SkyBlock").getAsJsonObject("profiles").entrySet()) {
ExampleUtil.API.getSkyBlockProfile(profileEntry.getKey()).whenComplete(ExampleUtil.getTestConsumer());
break;
}
});
ExampleUtil.await();
}
}
@@ -0,0 +1,10 @@
package net.hypixel.example.skyblock;

import net.hypixel.example.ExampleUtil;

public class GetSkyBlockSkillsExample {
public static void main(String[] args) {
ExampleUtil.API.getSkyBlockSkills().whenComplete(ExampleUtil.getTestConsumer());
ExampleUtil.await();
}
}
@@ -9,6 +9,10 @@
import net.hypixel.api.exceptions.APIThrottleException;
import net.hypixel.api.exceptions.HypixelAPIException;
import net.hypixel.api.reply.*;
import net.hypixel.api.reply.skyblock.SkyBlockCollectionsReply;
import net.hypixel.api.reply.skyblock.SkyBlockNewsReply;
import net.hypixel.api.reply.skyblock.SkyBlockProfileReply;
import net.hypixel.api.reply.skyblock.SkyBlockSkillsReply;
import net.hypixel.api.util.GameType;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
@@ -182,6 +186,22 @@ public UUID getApiKey() {
return get(GameCountsReply.class, "gameCounts");
}

public CompletableFuture<SkyBlockProfileReply> getSkyBlockProfile(String profile) {
return get(SkyBlockProfileReply.class, "skyblock/profile", "profile", profile);
}

public CompletableFuture<SkyBlockNewsReply> getSkyBlockNews() {
return get(SkyBlockNewsReply.class, "skyblock/news");
}

public CompletableFuture<SkyBlockCollectionsReply> getSkyBlockCollections() {
return get(SkyBlockCollectionsReply.class, "skyblock/collections");
}

public CompletableFuture<SkyBlockSkillsReply> getSkyBlockSkills() {
return get(SkyBlockSkillsReply.class, "skyblock/skills");
}

/**
* Execute Request asynchronously, executes Callback when finished
*
@@ -5,6 +5,10 @@
import java.util.Set;
import java.util.UUID;

/**
* This method is deprecated and will be removed soon.
*/
@Deprecated
public class SessionReply extends AbstractReply {
private Session session;

@@ -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.AbstractReply;

public class SkyBlockCollectionsReply extends AbstractReply {
private JsonElement collections;

public JsonObject getCollections() {
if (collections == null || collections.isJsonNull()) {
return null;
} else {
return collections.getAsJsonObject();
}
}

@Override
public String toString() {
return "SkyBlockCollectionsReply{" +
"collections=" + collections +
"} " + super.toString();
}
}
@@ -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.AbstractReply;

public class SkyBlockNewsReply extends AbstractReply {
private JsonElement items;

public JsonObject getItems() {
if (items == null || items.isJsonNull()) {
return null;
} else {
return items.getAsJsonObject();
}
}

@Override
public String toString() {
return "SkyBlockNewsReply{" +
"items=" + items +
"} " + super.toString();
}
}
@@ -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.AbstractReply;

public class SkyBlockProfileReply extends AbstractReply {
private JsonElement profile;

public JsonObject getProfile() {
if (profile == null || profile.isJsonNull()) {
return null;
} else {
return profile.getAsJsonObject();
}
}

@Override
public String toString() {
return "SkyBlockProfileReply{" +
"profile=" + profile +
"} " + super.toString();
}
}
@@ -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.AbstractReply;

public class SkyBlockSkillsReply extends AbstractReply {
private JsonElement skills;

public JsonObject getSkills() {
if (skills == null || skills.isJsonNull()) {
return null;
} else {
return skills.getAsJsonObject();
}
}

@Override
public String toString() {
return "SkyBlockSkillsReply{" +
"skills=" + skills +
"} " + super.toString();
}
}

0 comments on commit 357c62f

Please sign in to comment.
You can’t perform that action at this time.