diff --git a/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java b/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java index 7a06250070..432dc28bc8 100644 --- a/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java +++ b/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java @@ -64,7 +64,6 @@ public class RuneLiteAPI private static final String WSBASE = "https://api.runelite.net/ws"; private static final String STATICBASE = "https://static.runelite.net"; - private static final String OPENOSRS_BASE = /*"https://api.openosrs.com*/ "https://api.runelitepl.us"; private static final String OPENOSRS_SESSION = "http://session.openosrs.dev"; private static final String OPENOSRS_XTEA = "http://xtea.openosrs.dev"; private static final String OPENOSRS_ANIMATIONS = "http://animations.openosrs.dev"; @@ -151,11 +150,6 @@ public class RuneLiteAPI return HttpUrl.parse(BASE + "/runelite-" + getVersion()); } - public static HttpUrl getOpenOSRSApiBase() - { - return HttpUrl.parse(OPENOSRS_BASE + "/http-service-" + getRlpVersion()); - } - public static HttpUrl getStaticBase() { final String prop = System.getProperty("runelite.static.url"); diff --git a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java index 8753eee6b1..4a23d4ac06 100644 --- a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java +++ b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java @@ -27,8 +27,6 @@ package net.runelite.http.api.chat; import com.google.gson.JsonParseException; import java.io.IOException; import java.io.InputStream; -import java.util.function.Predicate; -import java.util.regex.Pattern; import java.io.InputStreamReader; import net.runelite.http.api.RuneLiteAPI; import okhttp3.HttpUrl; @@ -40,9 +38,6 @@ public class ChatClient { private static final RequestBody body = RequestBody.Companion.create(new byte[0], null); - private static final Predicate LAYOUT_VALIDATOR = Pattern - .compile("\\[[A-Z]+]:(\\s*\\w+\\s*(\\([A-Za-z]+\\))?,?)+") - .asPredicate(); public boolean submitKc(String username, String boss, int kc) throws IOException { @@ -56,7 +51,7 @@ public class ChatClient Request request = new Request.Builder() - .post(body) + .post(RequestBody.create(null, new byte[0])) .url(url) .build(); @@ -99,7 +94,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(body) + .post(RequestBody.create(null, new byte[0])) .url(url) .build(); @@ -144,7 +139,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(body) + .post(RequestBody.create(null, new byte[0])) .url(url) .build(); @@ -193,7 +188,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(body) + .post(RequestBody.create(null, new byte[0])) .url(url) .build(); @@ -236,7 +231,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(body) + .post(RequestBody.create(null, new byte[0])) .url(url) .build(); @@ -268,31 +263,6 @@ public class ChatClient } } - public boolean submitLayout(String username, String layout) throws IOException - { - if (!testLayout(layout)) - { - throw new IOException("Layout " + layout + " is not valid!"); - } - - HttpUrl url = RuneLiteAPI.getOpenOSRSApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("layout") - .addQueryParameter("name", username) - .addQueryParameter("layout", layout) - .build(); - - Request request = new Request.Builder() - .post(body) - .url(url) - .build(); - - try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) - { - return response.isSuccessful(); - } - } - public boolean submitDuels(String username, int wins, int losses, int winningStreak, int losingStreak) throws IOException { HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() @@ -306,7 +276,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(body) + .post(RequestBody.create(null, new byte[0])) .url(url) .build(); @@ -316,40 +286,6 @@ public class ChatClient } } - public boolean testLayout(String layout) - { - return LAYOUT_VALIDATOR.test(layout); - } - - public House[] getHosts(int world, String location) throws IOException - { - HttpUrl url = RuneLiteAPI.getOpenOSRSApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("hosts") - .addQueryParameter("world", Integer.toString(world)) - .addQueryParameter("location", location) - .build(); - - Request request = new Request.Builder() - .url(url) - .build(); - - try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) - { - if (!response.isSuccessful()) - { - throw new IOException("Unable to look up hosts!"); - } - - InputStream in = response.body().byteStream(); - return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), House[].class); - - } - catch (JsonParseException ex) - { - throw new IOException(ex); - } - } public Duels getDuels(String username) throws IOException { @@ -379,63 +315,6 @@ public class ChatClient } } - public boolean submitHost(int world, String location, House house) throws IOException - { - HttpUrl url = RuneLiteAPI.getOpenOSRSApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("hosts") - .addQueryParameter("world", Integer.toString(world)) - .addQueryParameter("location", location) - .addQueryParameter("owner", house.getOwner()) - .addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent())) - .addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent())) - .addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent())) - .addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent())) - .addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent())) - .addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent())) - .addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent())) - .build(); - - Request request = new Request.Builder() - .post(body) - .url(url) - .build(); - - try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) - { - return response.isSuccessful(); - } - } - - public boolean removeHost(int world, String location, House house) throws IOException - { - HttpUrl url = RuneLiteAPI.getOpenOSRSApiBase().newBuilder() - .addPathSegment("chat") - .addPathSegment("hosts") - .addQueryParameter("world", Integer.toString(world)) - .addQueryParameter("location", location) - .addQueryParameter("owner", house.getOwner()) - .addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent())) - .addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent())) - .addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent())) - .addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent())) - .addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent())) - .addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent())) - .addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent())) - .addQueryParameter("remove", Boolean.toString(true)) - .build(); - - Request request = new Request.Builder() - .post(body) - .url(url) - .build(); - - try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) - { - return response.isSuccessful(); - } - } - public boolean submitLayout(String username, LayoutRoom[] rooms) throws IOException { HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() @@ -482,4 +361,4 @@ public class ChatClient throw new IOException(ex); } } -} \ No newline at end of file +}