From 967adb226a0cbf3db0fef76cda76e887ea8ae332 Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Sun, 31 Oct 2021 15:09:48 +0200 Subject: [PATCH] Added User-Agent to Ore update checker to fix 403 error --- .../com/djrapitops/plan/version/ore/OreVersionInfoLoader.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plan/sponge/src/main/java/com/djrapitops/plan/version/ore/OreVersionInfoLoader.java b/Plan/sponge/src/main/java/com/djrapitops/plan/version/ore/OreVersionInfoLoader.java index e091e8a6d..ca17fa59c 100644 --- a/Plan/sponge/src/main/java/com/djrapitops/plan/version/ore/OreVersionInfoLoader.java +++ b/Plan/sponge/src/main/java/com/djrapitops/plan/version/ore/OreVersionInfoLoader.java @@ -76,6 +76,7 @@ public class OreVersionInfoLoader { connection.setDoOutput(true); connection.setRequestMethod("GET"); connection.setRequestProperty("Authorization", String.format("OreApi session=\"%s\"", session)); + connection.setRequestProperty("User-Agent", "Player Analytics Update Checker"); connection.connect(); try (InputStream in = connection.getInputStream()) { JsonArray versions = new JsonParser().parse(readInputFully(in)).getAsJsonObject().get("result").getAsJsonArray(); @@ -94,6 +95,7 @@ public class OreVersionInfoLoader { try { connection.setDoOutput(true); connection.setRequestMethod("POST"); + connection.setRequestProperty("User-Agent", "Player Analytics Update Checker"); connection.connect(); try (InputStream in = connection.getInputStream()) { return new JsonParser().parse(readInputFully(in)).getAsJsonObject().get("session").getAsString();