Consistently capitalize RuneLite
This commit is contained in:
@@ -26,7 +26,7 @@ For more information visit the [RuneLite Wiki](https://github.com/runelite/runel
|
|||||||
|
|
||||||
### License
|
### License
|
||||||
|
|
||||||
Most of Runelite is licensed under the BSD 2-clause license. See the license header in the respective file to be sure.
|
Most of RuneLite is licensed under the BSD 2-clause license. See the license header in the respective file to be sure.
|
||||||
Some of the code, like everything in runescape-client, is automatically generated, and is not licensed.
|
Some of the code, like everything in runescape-client, is automatically generated, and is not licensed.
|
||||||
|
|
||||||
## Contribute and Develop
|
## Contribute and Develop
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ import okhttp3.OkHttpClient;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class RuneliteAPI
|
public class RuneLiteAPI
|
||||||
{
|
{
|
||||||
private static final Logger logger = LoggerFactory.getLogger(RuneliteAPI.class);
|
private static final Logger logger = LoggerFactory.getLogger(RuneLiteAPI.class);
|
||||||
|
|
||||||
public static final String RUNELITE_AUTH = "RUNELITE-AUTH";
|
public static final String RUNELITE_AUTH = "RUNELITE-AUTH";
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ public class RuneliteAPI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
InputStream in = RuneliteAPI.class.getResourceAsStream("/runelite.properties");
|
InputStream in = RuneLiteAPI.class.getResourceAsStream("/runelite.properties");
|
||||||
properties.load(in);
|
properties.load(in);
|
||||||
|
|
||||||
version = properties.getProperty("runelite.version");
|
version = properties.getProperty("runelite.version");
|
||||||
@@ -81,7 +81,7 @@ public class RuneliteAPI
|
|||||||
|
|
||||||
public static void setVersion(String version)
|
public static void setVersion(String version)
|
||||||
{
|
{
|
||||||
RuneliteAPI.version = version;
|
RuneLiteAPI.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getRsVersion()
|
public static int getRsVersion()
|
||||||
@@ -29,7 +29,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
@@ -53,7 +53,7 @@ public class AccountClient
|
|||||||
|
|
||||||
public OAuthResponse login() throws IOException
|
public OAuthResponse login() throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("account")
|
.addPathSegment("account")
|
||||||
.addPathSegment("login")
|
.addPathSegment("login")
|
||||||
.build();
|
.build();
|
||||||
@@ -64,10 +64,10 @@ public class AccountClient
|
|||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), OAuthResponse.class);
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), OAuthResponse.class);
|
||||||
}
|
}
|
||||||
catch (JsonParseException ex)
|
catch (JsonParseException ex)
|
||||||
{
|
{
|
||||||
@@ -77,7 +77,7 @@ public class AccountClient
|
|||||||
|
|
||||||
public void logout() throws IOException
|
public void logout() throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("account")
|
.addPathSegment("account")
|
||||||
.addPathSegment("logout")
|
.addPathSegment("logout")
|
||||||
.build();
|
.build();
|
||||||
@@ -85,11 +85,11 @@ public class AccountClient
|
|||||||
logger.debug("Built URI: {}", url);
|
logger.debug("Built URI: {}", url);
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.header(RuneliteAPI.RUNELITE_AUTH, uuid.toString())
|
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
|
||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
logger.debug("Sent logout request");
|
logger.debug("Sent logout request");
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ public class AccountClient
|
|||||||
|
|
||||||
public boolean sesssionCheck()
|
public boolean sesssionCheck()
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("account")
|
.addPathSegment("account")
|
||||||
.addPathSegment("session-check")
|
.addPathSegment("session-check")
|
||||||
.build();
|
.build();
|
||||||
@@ -105,11 +105,11 @@ public class AccountClient
|
|||||||
logger.debug("Built URI: {}", url);
|
logger.debug("Built URI: {}", url);
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.header(RuneliteAPI.RUNELITE_AUTH, uuid.toString())
|
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
|
||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
return response.isSuccessful();
|
return response.isSuccessful();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
@@ -53,21 +53,21 @@ public class ConfigClient
|
|||||||
|
|
||||||
public Configuration get() throws IOException
|
public Configuration get() throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("config")
|
.addPathSegment("config")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
logger.debug("Built URI: {}", url);
|
logger.debug("Built URI: {}", url);
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.header(RuneliteAPI.RUNELITE_AUTH, uuid.toString())
|
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
|
||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), Configuration.class);
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), Configuration.class);
|
||||||
}
|
}
|
||||||
catch (JsonParseException ex)
|
catch (JsonParseException ex)
|
||||||
{
|
{
|
||||||
@@ -77,7 +77,7 @@ public class ConfigClient
|
|||||||
|
|
||||||
public void set(String key, String value) throws IOException
|
public void set(String key, String value) throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("config")
|
.addPathSegment("config")
|
||||||
.addPathSegment(key)
|
.addPathSegment(key)
|
||||||
.build();
|
.build();
|
||||||
@@ -86,11 +86,11 @@ public class ConfigClient
|
|||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.put(RequestBody.create(TEXT_PLAIN, value))
|
.put(RequestBody.create(TEXT_PLAIN, value))
|
||||||
.header(RuneliteAPI.RUNELITE_AUTH, uuid.toString())
|
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
|
||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
logger.debug("Set configuration value '{}' to '{}'", key, value);
|
logger.debug("Set configuration value '{}' to '{}'", key, value);
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ public class ConfigClient
|
|||||||
|
|
||||||
public void unset(String key) throws IOException
|
public void unset(String key) throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("config")
|
.addPathSegment("config")
|
||||||
.addPathSegment(key)
|
.addPathSegment(key)
|
||||||
.build();
|
.build();
|
||||||
@@ -107,11 +107,11 @@ public class ConfigClient
|
|||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.delete()
|
.delete()
|
||||||
.header(RuneliteAPI.RUNELITE_AUTH, uuid.toString())
|
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
|
||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
logger.debug("Unset configuration value '{}'", key);
|
logger.debug("Unset configuration value '{}'", key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
package net.runelite.http.api.examine;
|
package net.runelite.http.api.examine;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
@@ -57,7 +57,7 @@ public class ExamineClient
|
|||||||
|
|
||||||
private void submit(String type, int id, String text) throws IOException
|
private void submit(String type, int id, String text) throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("examine")
|
.addPathSegment("examine")
|
||||||
.addPathSegment(type)
|
.addPathSegment(type)
|
||||||
.addPathSegment(Integer.toString(id))
|
.addPathSegment(Integer.toString(id))
|
||||||
@@ -70,7 +70,7 @@ public class ExamineClient
|
|||||||
.post(RequestBody.create(TEXT, text))
|
.post(RequestBody.create(TEXT, text))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
logger.debug("Submitted examine info for {} {}: {}",
|
logger.debug("Submitted examine info for {} {}: {}",
|
||||||
type, id, text);
|
type, id, text);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import com.google.gson.JsonParseException;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
@@ -41,7 +41,7 @@ public class HiscoreClient
|
|||||||
|
|
||||||
public HiscoreResult lookup(String username, HiscoreEndpoint endpoint) throws IOException
|
public HiscoreResult lookup(String username, HiscoreEndpoint endpoint) throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl.Builder builder = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl.Builder builder = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("hiscore")
|
.addPathSegment("hiscore")
|
||||||
.addPathSegment(endpoint.name().toLowerCase())
|
.addPathSegment(endpoint.name().toLowerCase())
|
||||||
.addQueryParameter("username", username);
|
.addQueryParameter("username", username);
|
||||||
@@ -54,10 +54,10 @@ public class HiscoreClient
|
|||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), HiscoreResult.class);
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), HiscoreResult.class);
|
||||||
}
|
}
|
||||||
catch (JsonParseException ex)
|
catch (JsonParseException ex)
|
||||||
{
|
{
|
||||||
@@ -72,7 +72,7 @@ public class HiscoreClient
|
|||||||
|
|
||||||
public SingleHiscoreSkillResult lookup(String username, HiscoreSkill skill, HiscoreEndpoint endpoint) throws IOException
|
public SingleHiscoreSkillResult lookup(String username, HiscoreSkill skill, HiscoreEndpoint endpoint) throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl.Builder builder = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl.Builder builder = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("hiscore")
|
.addPathSegment("hiscore")
|
||||||
.addPathSegment(endpoint.name())
|
.addPathSegment(endpoint.name())
|
||||||
.addPathSegment(skill.toString().toLowerCase())
|
.addPathSegment(skill.toString().toLowerCase())
|
||||||
@@ -86,10 +86,10 @@ public class HiscoreClient
|
|||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), SingleHiscoreSkillResult.class);
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), SingleHiscoreSkillResult.class);
|
||||||
}
|
}
|
||||||
catch (JsonParseException ex)
|
catch (JsonParseException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import com.google.gson.JsonParseException;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
@@ -41,7 +41,7 @@ public class ItemClient
|
|||||||
|
|
||||||
public ItemPrice lookupItemPrice(int itemId) throws IOException
|
public ItemPrice lookupItemPrice(int itemId) throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("item")
|
.addPathSegment("item")
|
||||||
.addPathSegment("" + itemId)
|
.addPathSegment("" + itemId)
|
||||||
.addPathSegment("price")
|
.addPathSegment("price")
|
||||||
@@ -53,7 +53,7 @@ public class ItemClient
|
|||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
if (!response.isSuccessful())
|
if (!response.isSuccessful())
|
||||||
{
|
{
|
||||||
@@ -62,7 +62,7 @@ public class ItemClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), ItemPrice.class);
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), ItemPrice.class);
|
||||||
}
|
}
|
||||||
catch (JsonParseException ex)
|
catch (JsonParseException ex)
|
||||||
{
|
{
|
||||||
@@ -72,7 +72,7 @@ public class ItemClient
|
|||||||
|
|
||||||
public SearchResult search(String itemName) throws IOException
|
public SearchResult search(String itemName) throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("item")
|
.addPathSegment("item")
|
||||||
.addPathSegment("search")
|
.addPathSegment("search")
|
||||||
.addQueryParameter("query", itemName)
|
.addQueryParameter("query", itemName)
|
||||||
@@ -84,7 +84,7 @@ public class ItemClient
|
|||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
if (!response.isSuccessful())
|
if (!response.isSuccessful())
|
||||||
{
|
{
|
||||||
@@ -93,7 +93,7 @@ public class ItemClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), SearchResult.class);
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), SearchResult.class);
|
||||||
}
|
}
|
||||||
catch (JsonParseException ex)
|
catch (JsonParseException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import com.google.gson.JsonParseException;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
@@ -42,7 +42,7 @@ public class UpdateCheckClient
|
|||||||
|
|
||||||
public boolean isOutdated()
|
public boolean isOutdated()
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("update-check")
|
.addPathSegment("update-check")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -52,12 +52,12 @@ public class UpdateCheckClient
|
|||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
ResponseBody body = response.body();
|
ResponseBody body = response.body();
|
||||||
|
|
||||||
InputStream in = body.byteStream();
|
InputStream in = body.byteStream();
|
||||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), boolean.class);
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), boolean.class);
|
||||||
}
|
}
|
||||||
catch (JsonParseException | IOException ex)
|
catch (JsonParseException | IOException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
package net.runelite.http.api.worlds;
|
package net.runelite.http.api.worlds;
|
||||||
|
|
||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
@@ -43,7 +43,7 @@ public class WorldClient
|
|||||||
|
|
||||||
public WorldResult lookupWorlds() throws IOException
|
public WorldResult lookupWorlds() throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("worlds")
|
.addPathSegment("worlds")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ public class WorldClient
|
|||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
if (!response.isSuccessful())
|
if (!response.isSuccessful())
|
||||||
{
|
{
|
||||||
@@ -62,7 +62,7 @@ public class WorldClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), WorldResult.class);
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), WorldResult.class);
|
||||||
}
|
}
|
||||||
catch (JsonParseException ex)
|
catch (JsonParseException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
@@ -56,9 +56,9 @@ public class XteaClient
|
|||||||
|
|
||||||
xteaRequest.addKey(xteaKey);
|
xteaRequest.addKey(xteaKey);
|
||||||
|
|
||||||
String json = RuneliteAPI.GSON.toJson(xteaRequest);
|
String json = RuneLiteAPI.GSON.toJson(xteaRequest);
|
||||||
|
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("xtea")
|
.addPathSegment("xtea")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -69,12 +69,12 @@ public class XteaClient
|
|||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
return RuneliteAPI.CLIENT.newCall(request).execute();
|
return RuneLiteAPI.CLIENT.newCall(request).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<XteaKey> get() throws IOException
|
public List<XteaKey> get() throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("xtea")
|
.addPathSegment("xtea")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -82,11 +82,11 @@ public class XteaClient
|
|||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
// CHECKSTYLE:OFF
|
// CHECKSTYLE:OFF
|
||||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), new TypeToken<List<XteaKey>>() { }.getType());
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), new TypeToken<List<XteaKey>>() { }.getType());
|
||||||
// CHECKSTYLE:ON
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
catch (JsonParseException ex)
|
catch (JsonParseException ex)
|
||||||
@@ -97,7 +97,7 @@ public class XteaClient
|
|||||||
|
|
||||||
public XteaKey get(int region) throws IOException
|
public XteaKey get(int region) throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneliteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||||
.addPathSegment("xtea")
|
.addPathSegment("xtea")
|
||||||
.addPathSegment(Integer.toString(region))
|
.addPathSegment(Integer.toString(region))
|
||||||
.build();
|
.build();
|
||||||
@@ -106,10 +106,10 @@ public class XteaClient
|
|||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), XteaKey.class);
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), XteaKey.class);
|
||||||
}
|
}
|
||||||
catch (JsonParseException ex)
|
catch (JsonParseException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import net.runelite.http.api.account.OAuthResponse;
|
import net.runelite.http.api.account.OAuthResponse;
|
||||||
import net.runelite.http.api.ws.messages.LoginResponse;
|
import net.runelite.http.api.ws.messages.LoginResponse;
|
||||||
import net.runelite.http.service.ws.SessionManager;
|
import net.runelite.http.service.ws.SessionManager;
|
||||||
@@ -88,7 +88,7 @@ public class AccountService
|
|||||||
private static final String RL_OAUTH_URL = "https://api.runelite.net/oauth/";
|
private static final String RL_OAUTH_URL = "https://api.runelite.net/oauth/";
|
||||||
private static final String RL_REDIR = "http://runelite.net/logged-in";
|
private static final String RL_REDIR = "http://runelite.net/logged-in";
|
||||||
|
|
||||||
private final Gson gson = RuneliteAPI.GSON;
|
private final Gson gson = RuneLiteAPI.GSON;
|
||||||
|
|
||||||
private final Sql2o sql2o;
|
private final Sql2o sql2o;
|
||||||
private final String oauthClientId;
|
private final String oauthClientId;
|
||||||
@@ -135,7 +135,7 @@ public class AccountService
|
|||||||
|
|
||||||
State state = new State();
|
State state = new State();
|
||||||
state.setUuid(uuid);
|
state.setUuid(uuid);
|
||||||
state.setApiVersion(RuneliteAPI.getVersion());
|
state.setApiVersion(RuneLiteAPI.getVersion());
|
||||||
|
|
||||||
OAuth20Service service = new ServiceBuilder()
|
OAuth20Service service = new ServiceBuilder()
|
||||||
.apiKey(oauthClientId)
|
.apiKey(oauthClientId)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import java.time.Instant;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -51,7 +51,7 @@ public class AuthFilter
|
|||||||
|
|
||||||
public SessionEntry handle(HttpServletRequest request, HttpServletResponse response) throws IOException
|
public SessionEntry handle(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||||
{
|
{
|
||||||
String runeliteAuth = request.getHeader(RuneliteAPI.RUNELITE_AUTH);
|
String runeliteAuth = request.getHeader(RuneLiteAPI.RUNELITE_AUTH);
|
||||||
if (runeliteAuth == null)
|
if (runeliteAuth == null)
|
||||||
{
|
{
|
||||||
response.sendError(401, "Access denied");
|
response.sendError(401, "Access denied");
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import net.runelite.cache.client.CacheClient;
|
|||||||
import net.runelite.cache.client.IndexInfo;
|
import net.runelite.cache.client.IndexInfo;
|
||||||
import net.runelite.cache.fs.Archive;
|
import net.runelite.cache.fs.Archive;
|
||||||
import net.runelite.cache.fs.Store;
|
import net.runelite.cache.fs.Store;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import net.runelite.http.service.cache.beans.CacheEntry;
|
import net.runelite.http.service.cache.beans.CacheEntry;
|
||||||
import net.runelite.http.service.cache.beans.IndexEntry;
|
import net.runelite.http.service.cache.beans.IndexEntry;
|
||||||
import net.runelite.protocol.api.login.HandshakeResponseType;
|
import net.runelite.protocol.api.login.HandshakeResponseType;
|
||||||
@@ -76,7 +76,7 @@ public class CacheUpdater
|
|||||||
@RequestMapping("/update")
|
@RequestMapping("/update")
|
||||||
public void check() throws IOException, InvalidEndpointException, InvalidPortException, InterruptedException
|
public void check() throws IOException, InvalidEndpointException, InvalidPortException, InterruptedException
|
||||||
{
|
{
|
||||||
int rsVersion = RuneliteAPI.getRsVersion();
|
int rsVersion = RuneLiteAPI.getRsVersion();
|
||||||
|
|
||||||
try (Connection con = sql2o.beginTransaction())
|
try (Connection con = sql2o.beginTransaction())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
package net.runelite.http.service.hiscore;
|
package net.runelite.http.service.hiscore;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
||||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
import net.runelite.http.api.hiscore.HiscoreResult;
|
||||||
import net.runelite.http.api.hiscore.HiscoreSkill;
|
import net.runelite.http.api.hiscore.HiscoreSkill;
|
||||||
@@ -75,7 +75,7 @@ public class HiscoreService
|
|||||||
|
|
||||||
String responseStr;
|
String responseStr;
|
||||||
|
|
||||||
try (Response okresponse = RuneliteAPI.CLIENT.newCall(okrequest).execute())
|
try (Response okresponse = RuneLiteAPI.CLIENT.newCall(okrequest).execute())
|
||||||
{
|
{
|
||||||
if (!okresponse.isSuccessful())
|
if (!okresponse.isSuccessful())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import java.util.List;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import net.runelite.http.api.item.Item;
|
import net.runelite.http.api.item.Item;
|
||||||
import net.runelite.http.api.item.ItemPrice;
|
import net.runelite.http.api.item.ItemPrice;
|
||||||
import net.runelite.http.api.item.ItemType;
|
import net.runelite.http.api.item.ItemType;
|
||||||
@@ -93,7 +93,7 @@ public class ItemService
|
|||||||
private static final String CREATE_PRICES_IDX = "ALTER TABLE `prices`\n"
|
private static final String CREATE_PRICES_IDX = "ALTER TABLE `prices`\n"
|
||||||
+ " ADD UNIQUE KEY `item` (`item`,`time`);";
|
+ " ADD UNIQUE KEY `item` (`item`,`time`);";
|
||||||
|
|
||||||
private static final String RUNELITE_CACHE = "Runelite-Cache";
|
private static final String RUNELITE_CACHE = "RuneLite-Cache";
|
||||||
|
|
||||||
private final Sql2o sql2o;
|
private final Sql2o sql2o;
|
||||||
private final Cache<String, SearchResult> cachedSearches = CacheBuilder.newBuilder()
|
private final Cache<String, SearchResult> cachedSearches = CacheBuilder.newBuilder()
|
||||||
@@ -486,7 +486,7 @@ public class ItemService
|
|||||||
|
|
||||||
private <T> T fetchJson(Request request, Class<T> clazz) throws IOException
|
private <T> T fetchJson(Request request, Class<T> clazz) throws IOException
|
||||||
{
|
{
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
if (!response.isSuccessful())
|
if (!response.isSuccessful())
|
||||||
{
|
{
|
||||||
@@ -494,7 +494,7 @@ public class ItemService
|
|||||||
}
|
}
|
||||||
|
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
return RuneliteAPI.GSON.fromJson(new InputStreamReader(in), clazz);
|
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), clazz);
|
||||||
}
|
}
|
||||||
catch (JsonParseException ex)
|
catch (JsonParseException ex)
|
||||||
{
|
{
|
||||||
@@ -510,7 +510,7 @@ public class ItemService
|
|||||||
.url(httpUrl)
|
.url(httpUrl)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
if (!response.isSuccessful())
|
if (!response.isSuccessful())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import java.nio.ByteBuffer;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import net.runelite.http.api.worlds.WorldResult;
|
import net.runelite.http.api.worlds.WorldResult;
|
||||||
import net.runelite.http.service.worlds.WorldsService;
|
import net.runelite.http.service.worlds.WorldsService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -96,7 +96,7 @@ public class UpdateCheckService
|
|||||||
{
|
{
|
||||||
ByteBuffer buffer = ByteBuffer.allocate(5);
|
ByteBuffer buffer = ByteBuffer.allocate(5);
|
||||||
buffer.put(HANDSHAKE_TYPE);
|
buffer.put(HANDSHAKE_TYPE);
|
||||||
buffer.putInt(RuneliteAPI.getRsVersion());
|
buffer.putInt(RuneLiteAPI.getRsVersion());
|
||||||
|
|
||||||
InputStream is = socket.getInputStream();
|
InputStream is = socket.getInputStream();
|
||||||
OutputStream os = socket.getOutputStream();
|
OutputStream os = socket.getOutputStream();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.nio.ByteBuffer;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import net.runelite.http.api.worlds.World;
|
import net.runelite.http.api.worlds.World;
|
||||||
import net.runelite.http.api.worlds.WorldResult;
|
import net.runelite.http.api.worlds.WorldResult;
|
||||||
import net.runelite.http.api.worlds.WorldType;
|
import net.runelite.http.api.worlds.WorldType;
|
||||||
@@ -56,7 +56,7 @@ public class WorldsService
|
|||||||
|
|
||||||
byte[] b;
|
byte[] b;
|
||||||
|
|
||||||
try (Response okresponse = RuneliteAPI.CLIENT.newCall(okrequest).execute())
|
try (Response okresponse = RuneLiteAPI.CLIENT.newCall(okrequest).execute())
|
||||||
{
|
{
|
||||||
b = okresponse.body().bytes();
|
b = okresponse.body().bytes();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,5 +28,5 @@
|
|||||||
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
|
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
|
||||||
version="3.1">
|
version="3.1">
|
||||||
|
|
||||||
<display-name>Runelite API</display-name>
|
<display-name>RuneLite API</display-name>
|
||||||
</web-app>
|
</web-app>
|
||||||
6
pom.xml
6
pom.xml
@@ -31,7 +31,7 @@
|
|||||||
<version>1.2.11-SNAPSHOT</version>
|
<version>1.2.11-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>Runelite</name>
|
<name>RuneLite</name>
|
||||||
<description>Open source RuneScape client and deobfuscator</description>
|
<description>Open source RuneScape client and deobfuscator</description>
|
||||||
<url>http://runelite.net</url>
|
<url>http://runelite.net</url>
|
||||||
|
|
||||||
@@ -90,14 +90,14 @@
|
|||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>runelite</id>
|
<id>runelite</id>
|
||||||
<name>Runelite</name>
|
<name>RuneLite</name>
|
||||||
<url>http://repo.runelite.net</url>
|
<url>http://repo.runelite.net</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<pluginRepositories>
|
<pluginRepositories>
|
||||||
<pluginRepository>
|
<pluginRepository>
|
||||||
<id>runelite-plugins</id>
|
<id>runelite-plugins</id>
|
||||||
<name>Runelite Plugins</name>
|
<name>RuneLite Plugins</name>
|
||||||
<url>http://repo.runelite.net</url>
|
<url>http://repo.runelite.net</url>
|
||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
<groupId>net.runelite</groupId>
|
<groupId>net.runelite</groupId>
|
||||||
<artifactId>api</artifactId>
|
<artifactId>api</artifactId>
|
||||||
<name>Runelite API</name>
|
<name>RuneLite API</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
<groupId>net.runelite</groupId>
|
<groupId>net.runelite</groupId>
|
||||||
<artifactId>client</artifactId>
|
<artifactId>client</artifactId>
|
||||||
<name>Runelite Client</name>
|
<name>RuneLite Client</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<slf4j.version>1.7.12</slf4j.version>
|
<slf4j.version>1.7.12</slf4j.version>
|
||||||
|
|||||||
@@ -44,12 +44,12 @@ public class ClientLoader
|
|||||||
{
|
{
|
||||||
if (isOutdated)
|
if (isOutdated)
|
||||||
{
|
{
|
||||||
log.info("Runelite is outdated - fetching vanilla client");
|
log.info("RuneLite is outdated - fetching vanilla client");
|
||||||
return Optional.of(loadVanilla());
|
return Optional.of(loadVanilla());
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("Runelite is up to date");
|
log.debug("RuneLite is up to date");
|
||||||
return Optional.of(loadRunelite());
|
return Optional.of(loadRuneLite());
|
||||||
}
|
}
|
||||||
catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e)
|
catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e)
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,7 @@ public class ClientLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Applet loadRunelite() throws ClassNotFoundException, IOException, InstantiationException, IllegalAccessException
|
private Applet loadRuneLite() throws ClassNotFoundException, IOException, InstantiationException, IllegalAccessException
|
||||||
{
|
{
|
||||||
ConfigLoader config = new ConfigLoader();
|
ConfigLoader config = new ConfigLoader();
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
@@ -51,7 +51,7 @@ public class ConfigLoader
|
|||||||
.url(CONFIG_URL)
|
.url(CONFIG_URL)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneliteAPI.CLIENT.newCall(request).execute();
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute();
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(response.body().byteStream())))
|
BufferedReader in = new BufferedReader(new InputStreamReader(response.body().byteStream())))
|
||||||
{
|
{
|
||||||
String str;
|
String str;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class RuneLite
|
|||||||
private static OptionSet options;
|
private static OptionSet options;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private RuneliteProperties properties;
|
private RuneLiteProperties properties;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private PluginManager pluginManager;
|
private PluginManager pluginManager;
|
||||||
@@ -98,13 +98,13 @@ public class RuneLite
|
|||||||
|
|
||||||
PROFILES_DIR.mkdirs();
|
PROFILES_DIR.mkdirs();
|
||||||
|
|
||||||
setInjector(Guice.createInjector(new RuneliteModule()));
|
setInjector(Guice.createInjector(new RuneLiteModule()));
|
||||||
injector.getInstance(RuneLite.class).start();
|
injector.getInstance(RuneLite.class).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() throws Exception
|
public void start() throws Exception
|
||||||
{
|
{
|
||||||
// Load Runelite or Vanilla client
|
// Load RuneLite or Vanilla client
|
||||||
final boolean hasRs = !getOptions().has("no-rs");
|
final boolean hasRs = !getOptions().has("no-rs");
|
||||||
final Optional<Applet> optionalClient = hasRs
|
final Optional<Applet> optionalClient = hasRs
|
||||||
? new ClientLoader().loadRs()
|
? new ClientLoader().loadRs()
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import net.runelite.api.Client;
|
|||||||
import net.runelite.client.account.SessionManager;
|
import net.runelite.client.account.SessionManager;
|
||||||
import net.runelite.client.chat.ChatMessageManager;
|
import net.runelite.client.chat.ChatMessageManager;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.config.RuneliteConfig;
|
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.menus.MenuManager;
|
import net.runelite.client.menus.MenuManager;
|
||||||
import net.runelite.client.plugins.PluginManager;
|
import net.runelite.client.plugins.PluginManager;
|
||||||
@@ -44,9 +43,10 @@ import net.runelite.client.task.Scheduler;
|
|||||||
import net.runelite.client.ui.ClientUI;
|
import net.runelite.client.ui.ClientUI;
|
||||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
import net.runelite.client.util.QueryRunner;
|
import net.runelite.client.util.QueryRunner;
|
||||||
|
import net.runelite.client.config.RuneLiteConfig;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RuneliteModule extends AbstractModule
|
public class RuneLiteModule extends AbstractModule
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected void configure()
|
protected void configure()
|
||||||
@@ -59,7 +59,7 @@ public class RuneliteModule extends AbstractModule
|
|||||||
bind(InfoBoxManager.class);
|
bind(InfoBoxManager.class);
|
||||||
bind(Scheduler.class);
|
bind(Scheduler.class);
|
||||||
bind(PluginManager.class);
|
bind(PluginManager.class);
|
||||||
bind(RuneliteProperties.class);
|
bind(RuneLiteProperties.class);
|
||||||
bind(SessionManager.class);
|
bind(SessionManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,16 +83,16 @@ public class RuneliteModule extends AbstractModule
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
RuneliteConfig provideConfig(ConfigManager configManager)
|
RuneLiteConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
return configManager.getConfig(RuneliteConfig.class);
|
return configManager.getConfig(RuneLiteConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
EventBus provideEventBus()
|
EventBus provideEventBus()
|
||||||
{
|
{
|
||||||
return new EventBus(RuneliteModule::eventExceptionHandler);
|
return new EventBus(RuneLiteModule::eventExceptionHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void eventExceptionHandler(Throwable exception, SubscriberExceptionContext context)
|
private static void eventExceptionHandler(Throwable exception, SubscriberExceptionContext context)
|
||||||
@@ -34,7 +34,7 @@ import javax.inject.Singleton;
|
|||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RuneliteProperties
|
public class RuneLiteProperties
|
||||||
{
|
{
|
||||||
private static final String RUNELITE_TITLE = "runelite.title";
|
private static final String RUNELITE_TITLE = "runelite.title";
|
||||||
private static final String RUNELITE_VERSION = "runelite.version";
|
private static final String RUNELITE_VERSION = "runelite.version";
|
||||||
@@ -42,7 +42,7 @@ public class RuneliteProperties
|
|||||||
private final Properties properties = new Properties();
|
private final Properties properties = new Properties();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RuneliteProperties()
|
public RuneLiteProperties()
|
||||||
{
|
{
|
||||||
InputStream in = getClass().getResourceAsStream("runelite.properties");
|
InputStream in = getClass().getResourceAsStream("runelite.properties");
|
||||||
try
|
try
|
||||||
@@ -32,7 +32,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.http.api.RuneliteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import net.runelite.http.api.ws.WebsocketGsonFactory;
|
import net.runelite.http.api.ws.WebsocketGsonFactory;
|
||||||
import net.runelite.http.api.ws.WebsocketMessage;
|
import net.runelite.http.api.ws.WebsocketMessage;
|
||||||
import net.runelite.http.api.ws.messages.Handshake;
|
import net.runelite.http.api.ws.messages.Handshake;
|
||||||
@@ -72,7 +72,7 @@ public class WSClient extends WebSocketListener implements AutoCloseable
|
|||||||
public void connect()
|
public void connect()
|
||||||
{
|
{
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(RuneliteAPI.getWsEndpoint())
|
.url(RuneLiteAPI.getWsEndpoint())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
webSocket = client.newWebSocket(request, this);
|
webSocket = client.newWebSocket(request, this);
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ import net.runelite.api.ChatMessageType;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.MessageNode;
|
import net.runelite.api.MessageNode;
|
||||||
import net.runelite.api.Varbits;
|
import net.runelite.api.Varbits;
|
||||||
import net.runelite.client.config.RuneliteConfig;
|
|
||||||
import net.runelite.client.events.ResizeableChanged;
|
import net.runelite.client.events.ResizeableChanged;
|
||||||
import net.runelite.client.events.VarbitChanged;
|
import net.runelite.client.events.VarbitChanged;
|
||||||
|
import net.runelite.client.config.RuneLiteConfig;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -57,12 +57,12 @@ public class ChatMessageManager
|
|||||||
private final Map<ChatMessageType, Set<ChatColor>> colorCache = new HashMap<>();
|
private final Map<ChatMessageType, Set<ChatColor>> colorCache = new HashMap<>();
|
||||||
private final Provider<Client> clientProvider;
|
private final Provider<Client> clientProvider;
|
||||||
private final ScheduledExecutorService executor;
|
private final ScheduledExecutorService executor;
|
||||||
private final RuneliteConfig config;
|
private final RuneLiteConfig config;
|
||||||
private int transparancyVarbit = -1;
|
private int transparancyVarbit = -1;
|
||||||
private final Queue<QueuedMessage> queuedMessages = new ConcurrentLinkedQueue<>();
|
private final Queue<QueuedMessage> queuedMessages = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ChatMessageManager(Provider<Client> clientProvider, ScheduledExecutorService executor, RuneliteConfig config)
|
public ChatMessageManager(Provider<Client> clientProvider, ScheduledExecutorService executor, RuneLiteConfig config)
|
||||||
{
|
{
|
||||||
this.clientProvider = clientProvider;
|
this.clientProvider = clientProvider;
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ public class ConfigManager
|
|||||||
|
|
||||||
try (FileOutputStream out = new FileOutputStream(propertiesFile))
|
try (FileOutputStream out = new FileOutputStream(propertiesFile))
|
||||||
{
|
{
|
||||||
properties.store(out, "Runelite configuration");
|
properties.store(out, "RuneLite configuration");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ package net.runelite.client.config;
|
|||||||
|
|
||||||
@ConfigGroup(
|
@ConfigGroup(
|
||||||
keyName = "runelite",
|
keyName = "runelite",
|
||||||
name = "Runelite",
|
name = "RuneLite",
|
||||||
description = "Configuration for Runelite client options"
|
description = "Configuration for RuneLite client options"
|
||||||
)
|
)
|
||||||
public interface RuneliteConfig extends Config
|
public interface RuneLiteConfig extends Config
|
||||||
{
|
{
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "chatCommandsRecolorEnabled",
|
keyName = "chatCommandsRecolorEnabled",
|
||||||
@@ -45,7 +45,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.runelite.client.RuneLite;
|
import net.runelite.client.RuneLite;
|
||||||
import net.runelite.client.config.Config;
|
import net.runelite.client.config.Config;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.config.RuneliteConfig;
|
import net.runelite.client.config.RuneLiteConfig;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -53,7 +53,7 @@ public class PluginWatcher extends Thread
|
|||||||
{
|
{
|
||||||
private static final File BASE = RuneLite.PLUGIN_DIR;
|
private static final File BASE = RuneLite.PLUGIN_DIR;
|
||||||
|
|
||||||
private final RuneliteConfig runeliteConfig;
|
private final RuneLiteConfig runeliteConfig;
|
||||||
private final PluginManager pluginManager;
|
private final PluginManager pluginManager;
|
||||||
private final WatchService watchService;
|
private final WatchService watchService;
|
||||||
private final WatchKey watchKey;
|
private final WatchKey watchKey;
|
||||||
@@ -62,7 +62,7 @@ public class PluginWatcher extends Thread
|
|||||||
private ConfigManager configManager;
|
private ConfigManager configManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public PluginWatcher(RuneliteConfig runeliteConfig, PluginManager pluginManager) throws IOException
|
public PluginWatcher(RuneLiteConfig runeliteConfig, PluginManager pluginManager) throws IOException
|
||||||
{
|
{
|
||||||
this.runeliteConfig = runeliteConfig;
|
this.runeliteConfig = runeliteConfig;
|
||||||
this.pluginManager = pluginManager;
|
this.pluginManager = pluginManager;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ import lombok.Getter;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.client.RuneliteProperties;
|
import net.runelite.client.RuneLiteProperties;
|
||||||
import org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel;
|
import org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel;
|
||||||
import org.pushingpixels.substance.internal.ui.SubstanceRootPaneUI;
|
import org.pushingpixels.substance.internal.ui.SubstanceRootPaneUI;
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ public class ClientUI extends JFrame
|
|||||||
private TrayIcon trayIcon;
|
private TrayIcon trayIcon;
|
||||||
|
|
||||||
private final Applet client;
|
private final Applet client;
|
||||||
private final RuneliteProperties properties;
|
private final RuneLiteProperties properties;
|
||||||
private JPanel container;
|
private JPanel container;
|
||||||
private JPanel navContainer;
|
private JPanel navContainer;
|
||||||
private PluginToolbar pluginToolbar;
|
private PluginToolbar pluginToolbar;
|
||||||
@@ -96,7 +96,7 @@ public class ClientUI extends JFrame
|
|||||||
ICON = icon;
|
ICON = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ClientUI create(RuneliteProperties properties, Applet client)
|
public static ClientUI create(RuneLiteProperties properties, Applet client)
|
||||||
{
|
{
|
||||||
// Force heavy-weight popups/tooltips.
|
// Force heavy-weight popups/tooltips.
|
||||||
// Prevents them from being obscured by the game applet.
|
// Prevents them from being obscured by the game applet.
|
||||||
@@ -131,7 +131,7 @@ public class ClientUI extends JFrame
|
|||||||
return new ClientUI(properties, client);
|
return new ClientUI(properties, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClientUI(RuneliteProperties properties, Applet client)
|
private ClientUI(RuneLiteProperties properties, Applet client)
|
||||||
{
|
{
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ package net.runelite.client;
|
|||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class RuneliteModuleTest
|
public class RuneLiteModuleTest
|
||||||
{
|
{
|
||||||
@Test
|
@Test
|
||||||
public void testConfigure()
|
public void testConfigure()
|
||||||
{
|
{
|
||||||
Guice.createInjector(new RuneliteModule());
|
Guice.createInjector(new RuneLiteModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ public class ConfigManagerTest
|
|||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@Bind
|
@Bind
|
||||||
RuneliteConfig runeliteConfig;
|
RuneLiteConfig runeliteConfig;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ConfigManager manager;
|
ConfigManager manager;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import joptsimple.OptionSet;
|
import joptsimple.OptionSet;
|
||||||
import net.runelite.client.RuneLite;
|
import net.runelite.client.RuneLite;
|
||||||
import net.runelite.client.RuneliteModule;
|
import net.runelite.client.RuneLiteModule;
|
||||||
import net.runelite.client.ui.ClientUI;
|
import net.runelite.client.ui.ClientUI;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
@@ -61,7 +61,7 @@ public class PluginManagerTest
|
|||||||
{
|
{
|
||||||
RuneLite.setOptions(mock(OptionSet.class));
|
RuneLite.setOptions(mock(OptionSet.class));
|
||||||
|
|
||||||
Injector injector = Guice.createInjector(new RuneliteModule(),
|
Injector injector = Guice.createInjector(new RuneLiteModule(),
|
||||||
BoundFieldModule.of(this));
|
BoundFieldModule.of(this));
|
||||||
RuneLite.setInjector(injector);
|
RuneLite.setInjector(injector);
|
||||||
// test with no client bound
|
// test with no client bound
|
||||||
@@ -82,7 +82,7 @@ public class PluginManagerTest
|
|||||||
{
|
{
|
||||||
List<Module> modules = new ArrayList<>();
|
List<Module> modules = new ArrayList<>();
|
||||||
modules.add(new GraphvizModule());
|
modules.add(new GraphvizModule());
|
||||||
modules.add(new RuneliteModule());
|
modules.add(new RuneLiteModule());
|
||||||
|
|
||||||
PluginManager pluginManager = new PluginManager();
|
PluginManager pluginManager = new PluginManager();
|
||||||
pluginManager.loadCorePlugins();
|
pluginManager.loadCorePlugins();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
<groupId>net.runelite</groupId>
|
<groupId>net.runelite</groupId>
|
||||||
<artifactId>mixins</artifactId>
|
<artifactId>mixins</artifactId>
|
||||||
<name>Runelite Mixins</name>
|
<name>RuneLite Mixins</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
<artifactId>runelite-plugin-archetype</artifactId>
|
<artifactId>runelite-plugin-archetype</artifactId>
|
||||||
<packaging>maven-archetype</packaging>
|
<packaging>maven-archetype</packaging>
|
||||||
<name>Runelite Plugin Archetype</name>
|
<name>RuneLite Plugin Archetype</name>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<!-- filter archetype resource's pom to put project version in it -->
|
<!-- filter archetype resource's pom to put project version in it -->
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>runelite</id>
|
<id>runelite</id>
|
||||||
<name>Runelite</name>
|
<name>RuneLite</name>
|
||||||
<url>http://repo.runelite.net</url>
|
<url>http://repo.runelite.net</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|||||||
Reference in New Issue
Block a user