Add Wise Old Man to XP Updater plugin

This commit is contained in:
Psikoi
2020-04-28 17:54:38 +01:00
committed by Adam
parent 1778d5d79b
commit 07b8798cac
2 changed files with 37 additions and 1 deletions

View File

@@ -52,4 +52,15 @@ public interface XpUpdaterConfig extends Config
{
return false;
}
@ConfigItem(
position = 3,
keyName = "wiseoldman",
name = "Wise Old Man",
description = "Automatically updates your stats on wiseoldman.net when you log out"
)
default boolean wiseoldman()
{
return false;
}
}

View File

@@ -43,14 +43,16 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.HttpUrl;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
@PluginDescriptor(
name = "XP Updater",
description = "Automatically updates your stats on external xptrackers when you log out",
tags = {"cml", "templeosrs", "temple", "external", "integration"},
tags = {"cml", "crystalmathlabs", "templeosrs", "temple", "wom", "wiseoldman", "wise old man", "external", "integration"},
enabledByDefault = false
)
@Slf4j
@@ -164,6 +166,29 @@ public class XpUpdaterPlugin extends Plugin
sendRequest("TempleOSRS", request);
}
if (config.wiseoldman())
{
HttpUrl url = new HttpUrl.Builder()
.scheme("https")
.host("wiseoldman.net")
.addPathSegment("api")
.addPathSegment("players")
.addPathSegment("track")
.build();
RequestBody formBody = new FormBody.Builder()
.add("username", username)
.build();
Request request = new Request.Builder()
.header("User-Agent", "RuneLite")
.url(url)
.post(formBody)
.build();
sendRequest("Wise Old Man", request);
}
}
private static void sendRequest(String platform, Request request)