diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 9452be8d0d..855e9306fa 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -29,7 +29,6 @@ "https://checkstyle.org/dtds/configuration_1_3.dtd"> - @@ -61,7 +60,4 @@ - - - diff --git a/http-api/src/main/java/net/runelite/http/api/account/OAuthResponse.java b/http-api/src/main/java/net/runelite/http/api/account/OAuthResponse.java deleted file mode 100644 index 930540b6eb..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/account/OAuthResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.account; - -import java.util.UUID; -import lombok.Data; - -@Data -public class OAuthResponse -{ - private String oauthUrl; - private UUID uid; -} diff --git a/http-api/src/main/java/net/runelite/http/api/chat/Duels.java b/http-api/src/main/java/net/runelite/http/api/chat/Duels.java deleted file mode 100644 index ba117a526a..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/chat/Duels.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2019, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.chat; - -import lombok.Data; - -@Data -public class Duels -{ - private int wins; - private int losses; - private int winningStreak; - private int losingStreak; -} diff --git a/http-api/src/main/java/net/runelite/http/api/chat/LayoutRoom.java b/http-api/src/main/java/net/runelite/http/api/chat/LayoutRoom.java deleted file mode 100644 index 3498f83eed..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/chat/LayoutRoom.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2019, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.chat; - -public enum LayoutRoom -{ - START, - END, - SCAVENGERS, - FARMING, - EMPTY, - - TEKTON, - MUTTADILES, - GUARDIANS, - VESPULA, - SHAMANS, - VASA, - VANGUARDS, - MYSTICS, - UNKNOWN_COMBAT, - - CRABS, - ICE_DEMON, - TIGHTROPE, - THIEVING, - UNKNOWN_PUZZLE; -} diff --git a/http-api/src/main/java/net/runelite/http/api/chat/Task.java b/http-api/src/main/java/net/runelite/http/api/chat/Task.java deleted file mode 100644 index db38c90109..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/chat/Task.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2019, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.chat; - -import lombok.Data; - -@Data -public class Task -{ - private String task; - private int amount; - private int initialAmount; - private String location; -} diff --git a/http-api/src/main/java/net/runelite/http/api/config/ConfigEntry.java b/http-api/src/main/java/net/runelite/http/api/config/ConfigEntry.java deleted file mode 100644 index d8b69dae72..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/config/ConfigEntry.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.config; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ConfigEntry -{ - private String key; - private String value; -} diff --git a/http-api/src/main/java/net/runelite/http/api/config/Configuration.java b/http-api/src/main/java/net/runelite/http/api/config/Configuration.java deleted file mode 100644 index 44269b735a..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/config/Configuration.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.config; - -import java.util.ArrayList; -import java.util.List; -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class Configuration -{ - private List config = new ArrayList<>(); -} diff --git a/http-api/src/main/java/net/runelite/http/api/feed/FeedItem.java b/http-api/src/main/java/net/runelite/http/api/feed/FeedItem.java deleted file mode 100644 index 620f639d15..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/feed/FeedItem.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.feed; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.RequiredArgsConstructor; - -@Data -@RequiredArgsConstructor -@AllArgsConstructor -public class FeedItem -{ - private final FeedItemType type; - private String avatar; - private final String title; - private final String content; - private final String url; - private final long timestamp; -} diff --git a/http-api/src/main/java/net/runelite/http/api/feed/FeedItemType.java b/http-api/src/main/java/net/runelite/http/api/feed/FeedItemType.java deleted file mode 100644 index e3cc9443cd..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/feed/FeedItemType.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.feed; - -public enum FeedItemType -{ - BLOG_POST, - TWEET, - OSRS_NEWS -} diff --git a/http-api/src/main/java/net/runelite/http/api/feed/FeedResult.java b/http-api/src/main/java/net/runelite/http/api/feed/FeedResult.java deleted file mode 100644 index cf862b5be0..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/feed/FeedResult.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.feed; - -import java.util.List; -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class FeedResult -{ - private List items; -} diff --git a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java deleted file mode 100644 index fd6f6635d3..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2019, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.ge; - -import java.time.Instant; -import lombok.Data; -import net.runelite.http.api.worlds.WorldType; - -@Data -public class GrandExchangeTrade -{ - private boolean buy; - private boolean cancel; - private boolean login; - private int itemId; - private int qty; - private int dqty; - private int total; - private int spent; - private int dspent; - private int offer; - private int slot; - private WorldType worldType; - private int seq; - private Instant resetTime; -} diff --git a/http-api/src/main/java/net/runelite/http/api/gson/ColorTypeAdapter.java b/http-api/src/main/java/net/runelite/http/api/gson/ColorTypeAdapter.java deleted file mode 100644 index feec0f6d66..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/gson/ColorTypeAdapter.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2020 Abex - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.gson; - -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import java.awt.Color; -import java.io.IOException; - -public class ColorTypeAdapter extends TypeAdapter -{ - @Override - public void write(JsonWriter out, Color value) throws IOException - { - if (value == null) - { - out.nullValue(); - return; - } - - int rgba = value.getRGB(); - out.value(String.format("#%08X", rgba)); - } - - @Override - public Color read(JsonReader in) throws IOException - { - switch (in.peek()) - { - case NULL: - in.nextNull(); - return null; - case STRING: - { - String value = in.nextString(); - if (value.charAt(0) == '#') - { - value = value.substring(1); - } - int intValue = Integer.parseUnsignedInt(value, 16); - return new Color(intValue, true); - } - case BEGIN_OBJECT: - { - in.beginObject(); - double value = 0; - while (in.peek() != JsonToken.END_OBJECT) - { - switch (in.nextName()) - { - case "value": - value = in.nextDouble(); - break; - default: - in.skipValue(); - break; - } - } - in.endObject(); - return new Color((int) value, true); - } - } - return null; // throws - } -} diff --git a/http-api/src/main/java/net/runelite/http/api/gson/IllegalReflectionExclusion.java b/http-api/src/main/java/net/runelite/http/api/gson/IllegalReflectionExclusion.java deleted file mode 100644 index a25ffb79f7..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/gson/IllegalReflectionExclusion.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2020 Abex - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.gson; - -import com.google.gson.ExclusionStrategy; -import com.google.gson.FieldAttributes; -import java.lang.reflect.Modifier; -import java.util.HashSet; -import java.util.Set; - -public class IllegalReflectionExclusion implements ExclusionStrategy -{ - private static final Set PRIVATE_CLASSLOADERS = new HashSet<>(); - - static - { - for (ClassLoader cl = ClassLoader.getSystemClassLoader(); cl != null; ) - { - cl = cl.getParent(); - PRIVATE_CLASSLOADERS.add(cl); - } - } - - @Override - public boolean shouldSkipField(FieldAttributes f) - { - if (!PRIVATE_CLASSLOADERS.contains(f.getDeclaringClass().getClassLoader())) - { - return false; - } - - assert !Modifier.isPrivate(f.getDeclaringClass().getModifiers()) : "gsoning private class " + f.getDeclaringClass().getName(); - try - { - f.getDeclaringClass().getField(f.getName()); - } - catch (NoSuchFieldException e) - { - throw new AssertionError("gsoning private field " + f.getDeclaringClass() + "." + f.getName()); - } - return false; - } - - @Override - public boolean shouldSkipClass(Class clazz) - { - return false; - } -} diff --git a/http-api/src/main/java/net/runelite/http/api/gson/InstantTypeAdapter.java b/http-api/src/main/java/net/runelite/http/api/gson/InstantTypeAdapter.java deleted file mode 100644 index d5162c0e01..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/gson/InstantTypeAdapter.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2020 Abex - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.gson; - -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.time.Instant; - -// Just add water! -public class InstantTypeAdapter extends TypeAdapter -{ - @Override - public void write(JsonWriter out, Instant value) throws IOException - { - if (value == null) - { - out.nullValue(); - return; - } - - out.value(value.toEpochMilli()); - } - - @Override - public Instant read(JsonReader in) throws IOException - { - if (in.peek() == JsonToken.NULL) - { - in.nextNull(); - return null; - } - - if (in.peek() == JsonToken.NUMBER) - { - long jsTime = in.nextLong(); - return Instant.ofEpochMilli(jsTime); - } - - long seconds = 0; - int nanos = 0; - in.beginObject(); - while (in.peek() != JsonToken.END_OBJECT) - { - switch (in.nextName()) - { - case "nanos": - nanos = in.nextInt(); - break; - case "seconds": - seconds = in.nextLong(); - break; - } - } - in.endObject(); - - return Instant.ofEpochSecond(seconds, nanos); - } -} diff --git a/http-api/src/main/java/net/runelite/http/api/item/ItemEquipmentStats.java b/http-api/src/main/java/net/runelite/http/api/item/ItemEquipmentStats.java deleted file mode 100644 index 5848513c00..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/item/ItemEquipmentStats.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.item; - -import com.google.gson.annotations.SerializedName; -import lombok.Builder; -import lombok.Value; - -@Value -@Builder -public class ItemEquipmentStats -{ - private int slot; - - @SerializedName("is2h") - private boolean isTwoHanded; - - private int astab; - private int aslash; - private int acrush; - private int amagic; - private int arange; - - private int dstab; - private int dslash; - private int dcrush; - private int dmagic; - private int drange; - - private int str; - private int rstr; - private int mdmg; - private int prayer; - private int aspeed; -} diff --git a/http-api/src/main/java/net/runelite/http/api/item/ItemPrice.java b/http-api/src/main/java/net/runelite/http/api/item/ItemPrice.java deleted file mode 100644 index faf5bfc3fb..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/item/ItemPrice.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.item; - -import lombok.Data; - -@Data -public class ItemPrice -{ - private int id; - private String name; - private int price; - private int wikiPrice; -} diff --git a/http-api/src/main/java/net/runelite/http/api/loottracker/GameItem.java b/http-api/src/main/java/net/runelite/http/api/loottracker/GameItem.java deleted file mode 100644 index 7e9b06c21b..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/loottracker/GameItem.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018, TheStonedTurtle - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.loottracker; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class GameItem -{ - private int id; - private int qty; -} diff --git a/http-api/src/main/java/net/runelite/http/api/loottracker/LootAggregate.java b/http-api/src/main/java/net/runelite/http/api/loottracker/LootAggregate.java deleted file mode 100644 index a5437226cc..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/loottracker/LootAggregate.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2020, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.loottracker; - -import java.time.Instant; -import java.util.Collection; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class LootAggregate -{ - private String eventId; - private LootRecordType type; - private Collection drops; - private Instant first_time; - private Instant last_time; - private int amount; -} diff --git a/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecord.java b/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecord.java deleted file mode 100644 index a8e04aefd3..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecord.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018, TheStonedTurtle - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.loottracker; - -import java.time.Instant; -import java.util.Collection; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class LootRecord -{ - private String eventId; - private LootRecordType type; - private Object metadata; - private Collection drops; - private Instant time; - private Integer world; -} diff --git a/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecordType.java b/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecordType.java deleted file mode 100644 index 33e622de45..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecordType.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018, TheStonedTurtle - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.loottracker; - -public enum LootRecordType -{ - NPC, - PLAYER, - EVENT, - PICKPOCKET, - UNKNOWN -} diff --git a/http-api/src/main/java/net/runelite/http/api/worlds/World.java b/http-api/src/main/java/net/runelite/http/api/worlds/World.java deleted file mode 100644 index 70bc2c8237..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/worlds/World.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.worlds; - -import java.util.EnumSet; -import lombok.Builder; -import lombok.Value; - -@Value -@Builder -public class World -{ - private int id; - private EnumSet types; - private String address; - private String activity; - private int location; - private int players; - - public WorldRegion getRegion() - { - return WorldRegion.valueOf(location); - } -} diff --git a/http-api/src/main/java/net/runelite/http/api/worlds/WorldRegion.java b/http-api/src/main/java/net/runelite/http/api/worlds/WorldRegion.java deleted file mode 100644 index 2c391e91f4..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/worlds/WorldRegion.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2020, melky - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.worlds; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * Holds the data for each world's region (location) - */ -@AllArgsConstructor -@Getter -public enum WorldRegion -{ - UNITED_STATES_OF_AMERICA("US", "USA"), - UNITED_KINGDOM("GB", "GBR"), - AUSTRALIA("AU", "AUS"), - GERMANY("DE", "DEU"); - - /** - * ISO-3166-1 alpha-2 country code - */ - private final String alpha2; - /** - * ISO-3166-1 alpha-3 country code - */ - private final String alpha3; - - /** - * Gets the region using the location id - * {@link WorldRegion} value. - * - * @param locationId the location id of world - * @return WorldRegion the region of the world - */ - public static WorldRegion valueOf(int locationId) - { - switch (locationId) - { - case 0: - return UNITED_STATES_OF_AMERICA; - case 1: - return UNITED_KINGDOM; - case 3: - return AUSTRALIA; - case 7: - return GERMANY; - default: - return null; - } - } -} diff --git a/http-api/src/main/java/net/runelite/http/api/worlds/WorldType.java b/http-api/src/main/java/net/runelite/http/api/worlds/WorldType.java deleted file mode 100644 index 20639b5f3c..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/worlds/WorldType.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.worlds; - -public enum WorldType -{ - MEMBERS, - PVP, - BOUNTY, - SKILL_TOTAL, - HIGH_RISK, - LAST_MAN_STANDING, - NOSAVE_MODE, - DEADMAN, - TOURNAMENT, - SEASONAL; -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/RuntimeTypeAdapterFactory.java b/http-api/src/main/java/net/runelite/http/api/ws/RuntimeTypeAdapterFactory.java deleted file mode 100644 index 2819c92ceb..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/RuntimeTypeAdapterFactory.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.runelite.http.api.ws; - -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.JsonPrimitive; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.internal.Streams; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * Adapts values whose runtime type may differ from their declaration type. This - * is necessary when a field's type is not the same type that GSON should create - * when deserializing that field. For example, consider these types: - *
   {@code
- *   abstract class Shape {
- *     int x;
- *     int y;
- *   }
- *   class Circle extends Shape {
- *     int radius;
- *   }
- *   class Rectangle extends Shape {
- *     int width;
- *     int height;
- *   }
- *   class Diamond extends Shape {
- *     int width;
- *     int height;
- *   }
- *   class Drawing {
- *     Shape bottomShape;
- *     Shape topShape;
- *   }
- * }
- *

Without additional type information, the serialized JSON is ambiguous. Is - * the bottom shape in this drawing a rectangle or a diamond?

   {@code
- *   {
- *     "bottomShape": {
- *       "width": 10,
- *       "height": 5,
- *       "x": 0,
- *       "y": 0
- *     },
- *     "topShape": {
- *       "radius": 2,
- *       "x": 4,
- *       "y": 1
- *     }
- *   }}
- * This class addresses this problem by adding type information to the - * serialized JSON and honoring that type information when the JSON is - * deserialized:
   {@code
- *   {
- *     "bottomShape": {
- *       "type": "Diamond",
- *       "width": 10,
- *       "height": 5,
- *       "x": 0,
- *       "y": 0
- *     },
- *     "topShape": {
- *       "type": "Circle",
- *       "radius": 2,
- *       "x": 4,
- *       "y": 1
- *     }
- *   }}
- * Both the type field name ({@code "type"}) and the type labels ({@code - * "Rectangle"}) are configurable. - * - *

Registering Types

- * Create a {@code RuntimeTypeAdapterFactory} by passing the base type and type field - * name to the {@link #of} factory method. If you don't supply an explicit type - * field name, {@code "type"} will be used.
   {@code
- *   RuntimeTypeAdapterFactory shapeAdapterFactory
- *       = RuntimeTypeAdapterFactory.of(Shape.class, "type");
- * }
- * Next register all of your subtypes. Every subtype must be explicitly - * registered. This protects your application from injection attacks. If you - * don't supply an explicit type label, the type's simple name will be used. - *
   {@code
- *   shapeAdapter.registerSubtype(Rectangle.class, "Rectangle");
- *   shapeAdapter.registerSubtype(Circle.class, "Circle");
- *   shapeAdapter.registerSubtype(Diamond.class, "Diamond");
- * }
- * Finally, register the type adapter factory in your application's GSON builder: - *
   {@code
- *   Gson gson = new GsonBuilder()
- *       .registerTypeAdapterFactory(shapeAdapterFactory)
- *       .create();
- * }
- * Like {@code GsonBuilder}, this API supports chaining:
   {@code
- *   RuntimeTypeAdapterFactory shapeAdapterFactory = RuntimeTypeAdapterFactory.of(Shape.class)
- *       .registerSubtype(Rectangle.class)
- *       .registerSubtype(Circle.class)
- *       .registerSubtype(Diamond.class);
- * }
- */ -public final class RuntimeTypeAdapterFactory implements TypeAdapterFactory { - private final Class baseType; - private final String typeFieldName; - private final Map> labelToSubtype = new LinkedHashMap>(); - private final Map, String> subtypeToLabel = new LinkedHashMap, String>(); - - private RuntimeTypeAdapterFactory(Class baseType, String typeFieldName) { - if (typeFieldName == null || baseType == null) { - throw new NullPointerException(); - } - this.baseType = baseType; - this.typeFieldName = typeFieldName; - } - - /** - * Creates a new runtime type adapter using for {@code baseType} using {@code - * typeFieldName} as the type field name. Type field names are case sensitive. - */ - public static RuntimeTypeAdapterFactory of(Class baseType, String typeFieldName) { - return new RuntimeTypeAdapterFactory(baseType, typeFieldName); - } - - /** - * Creates a new runtime type adapter for {@code baseType} using {@code "type"} as - * the type field name. - */ - public static RuntimeTypeAdapterFactory of(Class baseType) { - return new RuntimeTypeAdapterFactory(baseType, "type"); - } - - /** - * Registers {@code type} identified by {@code label}. Labels are case - * sensitive. - * - * @throws IllegalArgumentException if either {@code type} or {@code label} - * have already been registered on this type adapter. - */ - public RuntimeTypeAdapterFactory registerSubtype(Class type, String label) { - if (type == null || label == null) { - throw new NullPointerException(); - } - if (subtypeToLabel.containsKey(type) || labelToSubtype.containsKey(label)) { - throw new IllegalArgumentException("types and labels must be unique"); - } - labelToSubtype.put(label, type); - subtypeToLabel.put(type, label); - return this; - } - - /** - * Registers {@code type} identified by its {@link Class#getSimpleName simple - * name}. Labels are case sensitive. - * - * @throws IllegalArgumentException if either {@code type} or its simple name - * have already been registered on this type adapter. - */ - public RuntimeTypeAdapterFactory registerSubtype(Class type) { - return registerSubtype(type, type.getSimpleName()); - } - - public TypeAdapter create(Gson gson, TypeToken type) { - if (type.getRawType() != baseType) { - return null; - } - - final Map> labelToDelegate - = new LinkedHashMap>(); - final Map, TypeAdapter> subtypeToDelegate - = new LinkedHashMap, TypeAdapter>(); - for (Map.Entry> entry : labelToSubtype.entrySet()) { - TypeAdapter delegate = gson.getDelegateAdapter(this, TypeToken.get(entry.getValue())); - labelToDelegate.put(entry.getKey(), delegate); - subtypeToDelegate.put(entry.getValue(), delegate); - } - - return new TypeAdapter() { - @Override public R read(JsonReader in) throws IOException { - JsonElement jsonElement = Streams.parse(in); - JsonElement labelJsonElement = jsonElement.getAsJsonObject().remove(typeFieldName); - if (labelJsonElement == null) { - throw new JsonParseException("cannot deserialize " + baseType - + " because it does not define a field named " + typeFieldName); - } - String label = labelJsonElement.getAsString(); - @SuppressWarnings("unchecked") // registration requires that subtype extends T - TypeAdapter delegate = (TypeAdapter) labelToDelegate.get(label); - if (delegate == null) { - throw new JsonParseException("cannot deserialize " + baseType + " subtype named " - + label + "; did you forget to register a subtype?"); - } - return delegate.fromJsonTree(jsonElement); - } - - @Override public void write(JsonWriter out, R value) throws IOException { - Class srcType = value.getClass(); - String label = subtypeToLabel.get(srcType); - @SuppressWarnings("unchecked") // registration requires that subtype extends T - TypeAdapter delegate = (TypeAdapter) subtypeToDelegate.get(srcType); - if (delegate == null) { - throw new JsonParseException("cannot serialize " + srcType.getName() - + "; did you forget to register a subtype?"); - } - JsonObject jsonObject = delegate.toJsonTree(value).getAsJsonObject(); - if (jsonObject.has(typeFieldName)) { - throw new JsonParseException("cannot serialize " + srcType.getName() - + " because it already defines a field named " + typeFieldName); - } - JsonObject clone = new JsonObject(); - clone.add(typeFieldName, new JsonPrimitive(label)); - for (Map.Entry e : jsonObject.entrySet()) { - clone.add(e.getKey(), e.getValue()); - } - Streams.write(clone, out); - } - }.nullSafe(); - } -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/WebsocketGsonFactory.java b/http-api/src/main/java/net/runelite/http/api/ws/WebsocketGsonFactory.java deleted file mode 100644 index 328d0aa1a7..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/WebsocketGsonFactory.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.ws; - -import com.google.gson.Gson; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import net.runelite.http.api.RuneLiteAPI; -import net.runelite.http.api.ws.messages.Handshake; -import net.runelite.http.api.ws.messages.LoginResponse; -import net.runelite.http.api.ws.messages.party.Join; -import net.runelite.http.api.ws.messages.party.Part; -import net.runelite.http.api.ws.messages.party.PartyChatMessage; -import net.runelite.http.api.ws.messages.party.UserJoin; -import net.runelite.http.api.ws.messages.party.UserPart; -import net.runelite.http.api.ws.messages.party.UserSync; - -public class WebsocketGsonFactory -{ - private static final Collection> MESSAGES; - - static - { - final List> messages = new ArrayList<>(); - messages.add(Handshake.class); - messages.add(LoginResponse.class); - messages.add(Join.class); - messages.add(Part.class); - messages.add(UserJoin.class); - messages.add(UserPart.class); - messages.add(UserSync.class); - messages.add(PartyChatMessage.class); - MESSAGES = messages; - } - - public static RuntimeTypeAdapterFactory factory(final Collection> messages) - { - final RuntimeTypeAdapterFactory factory = RuntimeTypeAdapterFactory.of(WebsocketMessage.class); - - for (Class message : MESSAGES) - { - factory.registerSubtype(message); - } - - for (Class message : messages) - { - factory.registerSubtype(message); - } - - return factory; - } - - public static Gson build(final RuntimeTypeAdapterFactory factory) - { - return RuneLiteAPI.GSON.newBuilder() - .registerTypeAdapterFactory(factory) - .create(); - } - - public static Gson build() - { - return build(factory(Collections.emptyList())); - } -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/Handshake.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/Handshake.java deleted file mode 100644 index 5320c95ab5..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/Handshake.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.ws.messages; - -import java.util.UUID; -import lombok.Data; -import net.runelite.http.api.ws.WebsocketMessage; - -@Data -public class Handshake extends WebsocketMessage -{ - private UUID session; -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/LoginResponse.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/LoginResponse.java deleted file mode 100644 index 8f22db8f80..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/LoginResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.ws.messages; - -import lombok.Data; -import net.runelite.http.api.ws.WebsocketMessage; - -/** - * Called after a successful login to the server - */ -@Data -public class LoginResponse extends WebsocketMessage -{ - private String username; -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/Join.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/Join.java deleted file mode 100644 index 21aed0f653..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/Join.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.ws.messages.party; - -import java.util.UUID; -import lombok.EqualsAndHashCode; -import lombok.Value; -import net.runelite.http.api.ws.WebsocketMessage; - -@Value -@EqualsAndHashCode(callSuper = true) -public class Join extends WebsocketMessage -{ - private final UUID partyId; - private final String name; -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/Part.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/Part.java deleted file mode 100644 index e284ff0cf8..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/Part.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.ws.messages.party; - -import net.runelite.http.api.ws.WebsocketMessage; - -public class Part extends WebsocketMessage -{ -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/PartyChatMessage.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/PartyChatMessage.java deleted file mode 100644 index 480e2660c1..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/PartyChatMessage.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.ws.messages.party; - -import lombok.Value; - -@Value -public class PartyChatMessage extends PartyMemberMessage -{ - private final String value; -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/PartyMemberMessage.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/PartyMemberMessage.java deleted file mode 100644 index 9d5cab8545..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/PartyMemberMessage.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.runelite.http.api.ws.messages.party; - -import java.util.UUID; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public abstract class PartyMemberMessage extends PartyMessage -{ - private UUID memberId; -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/PartyMessage.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/PartyMessage.java deleted file mode 100644 index 709457ed8c..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/PartyMessage.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.ws.messages.party; - -import net.runelite.http.api.ws.WebsocketMessage; - -public abstract class PartyMessage extends WebsocketMessage -{ - public PartyMessage() - { - _party = true; - } -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserJoin.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserJoin.java deleted file mode 100644 index 7f940e8060..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserJoin.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.ws.messages.party; - -import java.util.UUID; -import lombok.EqualsAndHashCode; -import lombok.Value; -import net.runelite.http.api.ws.WebsocketMessage; - -@Value -@EqualsAndHashCode(callSuper = true) -public class UserJoin extends WebsocketMessage -{ - private final UUID memberId; - private final UUID partyId; - private final String name; -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserPart.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserPart.java deleted file mode 100644 index e80c6002bd..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserPart.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.ws.messages.party; - -import java.util.UUID; -import lombok.EqualsAndHashCode; -import lombok.Value; -import net.runelite.http.api.ws.WebsocketMessage; - -@Value -@EqualsAndHashCode(callSuper = true) -public class UserPart extends WebsocketMessage -{ - private final UUID memberId; -} diff --git a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserSync.java b/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserSync.java deleted file mode 100644 index c95038c9fa..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/ws/messages/party/UserSync.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.ws.messages.party; - -import lombok.EqualsAndHashCode; -import lombok.Value; - -@Value -@EqualsAndHashCode(callSuper = true) -public class UserSync extends PartyMemberMessage -{ -} diff --git a/http-api/src/main/java/net/runelite/http/api/xtea/XteaKey.java b/http-api/src/main/java/net/runelite/http/api/xtea/XteaKey.java deleted file mode 100644 index bed2a017f1..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/xtea/XteaKey.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.xtea; - -import lombok.Data; - -@Data -public class XteaKey -{ - private int region; - private int keys[]; -} diff --git a/http-api/src/main/java/net/runelite/http/api/xtea/XteaRequest.java b/http-api/src/main/java/net/runelite/http/api/xtea/XteaRequest.java deleted file mode 100644 index fdce607f59..0000000000 --- a/http-api/src/main/java/net/runelite/http/api/xtea/XteaRequest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.http.api.xtea; - -import java.util.ArrayList; -import java.util.List; -import lombok.Data; - -@Data -public class XteaRequest -{ - private int revision; - private List keys = new ArrayList<>(); - - public void addKey(XteaKey key) - { - keys.add(key); - } -} diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 3416338a3b..b3feee5a7c 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1114,7 +1114,9 @@ public interface Client extends GameEngine * Loads a model from the cache * * @param id the ID of the model + * @return the model or null if it is loading or nonexistent */ + @Nullable Model loadModel(int id); /** @@ -1123,7 +1125,9 @@ public interface Client extends GameEngine * @param id the ID of the model * @param colorToFind array of hsl color values to find in the model to replace * @param colorToReplace array of hsl color values to replace in the model + * @return the model or null if it is loading or nonexistent */ + @Nullable Model loadModel(int id, short[] colorToFind, short[] colorToReplace); /** diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java b/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java index 2436c9ac3b..cc62a9e9ef 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java @@ -53,6 +53,12 @@ public interface ScriptEvent */ ScriptEvent setSource(Widget widget); + /** + * Arguments passed to the script. Index 0 is the script being run and is not an argument. + * @return + */ + Object[] getArguments(); + /** * Gets the menu index of the event * @@ -73,6 +79,11 @@ public interface ScriptEvent */ int getMouseX(); + /** + * Parent relative y coordinate for mouse related events + */ + int getMouseY(); + /** * Jagex typed keycode * diff --git a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java index d24174feab..a41f1cc869 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java @@ -199,7 +199,7 @@ public class WorldPoint // get the template chunk for the chunk int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks(); - int templateChunk = instanceTemplateChunks[client.getPlane()][chunkX][chunkY]; + int templateChunk = instanceTemplateChunks[plane][chunkX][chunkY]; int rotation = templateChunk >> 1 & 0x3; int templateChunkY = (templateChunk >> 3 & 0x7FF) * CHUNK_SIZE; diff --git a/runelite-client/src/main/java/net/runelite/client/ClientSessionManager.java b/runelite-client/src/main/java/net/runelite/client/ClientSessionManager.java index 7c696792ab..4f3ef00b79 100644 --- a/runelite-client/src/main/java/net/runelite/client/ClientSessionManager.java +++ b/runelite-client/src/main/java/net/runelite/client/ClientSessionManager.java @@ -38,7 +38,6 @@ import net.runelite.api.GameState; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.events.ClientShutdown; import net.runelite.client.util.RunnableExceptionLogger; -import okhttp3.OkHttpClient; @Singleton @Slf4j @@ -54,11 +53,11 @@ public class ClientSessionManager @Inject ClientSessionManager(ScheduledExecutorService executorService, @Nullable Client client, - OkHttpClient okHttpClient) + SessionClient sessionClient) { this.executorService = executorService; this.client = client; - this.sessionClient = new SessionClient(okHttpClient); + this.sessionClient = sessionClient; } public void start() diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLite.java b/runelite-client/src/main/java/net/runelite/client/RuneLite.java index 96b5ed19b2..f62282759d 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLite.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLite.java @@ -49,6 +49,7 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.cert.X509Certificate; import java.util.Locale; +import java.util.concurrent.TimeUnit; import java.util.Optional; import java.util.stream.Stream; import javax.annotation.Nullable; @@ -91,6 +92,7 @@ import net.runelite.http.api.worlds.World; import net.runelite.http.api.worlds.WorldResult; import okhttp3.Cache; import okhttp3.OkHttpClient; +import okhttp3.Request; import okhttp3.Response; import org.slf4j.LoggerFactory; @@ -109,6 +111,7 @@ public class RuneLite public static final File DEFAULT_CONFIG_FILE = new File(RUNELITE_DIR, "settings.properties"); private static final int MAX_OKHTTP_CACHE_SIZE = 20 * 1024 * 1024; // 20mb + public static String USER_AGENT = "RuneLite/" + RuneLiteProperties.getVersion() + "-" + RuneLiteProperties.getCommit() + (RuneLiteProperties.isDirty() ? "+" : ""); @Getter private static Injector injector; @@ -273,16 +276,8 @@ public class RuneLite OpenOSRS.preload(); - OkHttpClient.Builder okHttpClientBuilder = RuneLiteAPI.CLIENT.newBuilder(); - setupCache(okHttpClientBuilder, new File(CACHE_DIR, "okhttp")); - - final boolean insecureSkipTlsVerification = options.has("insecure-skip-tls-verification"); - if (insecureSkipTlsVerification || RuneLiteProperties.isInsecureSkipTlsVerification()) - { - setupInsecureTrustManager(okHttpClientBuilder); - } - - final OkHttpClient okHttpClient = okHttpClientBuilder.build(); + final OkHttpClient okHttpClient = buildHttpClient(options.has("insecure-skip-tls-verification")); + RuneLiteAPI.CLIENT = okHttpClient; SplashScreen.init(); OpenOSRSSplashScreen.init(); @@ -532,9 +527,20 @@ public class RuneLite } @VisibleForTesting - static void setupCache(OkHttpClient.Builder builder, File cacheDir) + static OkHttpClient buildHttpClient(boolean insecureSkipTlsVerification) { - builder.cache(new Cache(cacheDir, MAX_OKHTTP_CACHE_SIZE)) + OkHttpClient.Builder builder = new OkHttpClient.Builder() + .pingInterval(30, TimeUnit.SECONDS) + .addNetworkInterceptor(chain -> + { + Request userAgentRequest = chain.request() + .newBuilder() + .header("User-Agent", USER_AGENT) + .build(); + return chain.proceed(userAgentRequest); + }) + // Setup cache + .cache(new Cache(new File(CACHE_DIR, "okhttp"), MAX_OKHTTP_CACHE_SIZE)) .addNetworkInterceptor(chain -> { // This has to be a network interceptor so it gets hit before the cache tries to store stuff @@ -548,6 +554,13 @@ public class RuneLite } return res; }); + + if (insecureSkipTlsVerification || RuneLiteProperties.isInsecureSkipTlsVerification()) + { + setupInsecureTrustManager(builder); + } + + return builder.build(); } private static void setupInsecureTrustManager(OkHttpClient.Builder okHttpClientBuilder) diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLiteModule.java b/runelite-client/src/main/java/net/runelite/client/RuneLiteModule.java index 5d1f43b030..6a5a79dee5 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLiteModule.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLiteModule.java @@ -25,6 +25,7 @@ package net.runelite.client; import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.google.common.base.Strings; import com.google.gson.Gson; import com.google.inject.AbstractModule; import com.google.inject.Provides; @@ -41,6 +42,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import javax.annotation.Nullable; +import javax.inject.Named; import javax.inject.Singleton; import lombok.AllArgsConstructor; import net.runelite.api.Client; @@ -59,7 +61,7 @@ import net.runelite.client.task.Scheduler; import net.runelite.client.util.DeferredEventBus; import net.runelite.client.util.ExecutorServiceExceptionLogger; import net.runelite.http.api.RuneLiteAPI; -import net.runelite.http.api.chat.ChatClient; +import okhttp3.HttpUrl; import okhttp3.OkHttpClient; @AllArgsConstructor @@ -135,10 +137,35 @@ public class RuneLiteModule extends AbstractModule } @Provides - @Singleton - ChatClient provideChatClient(OkHttpClient okHttpClient) + @Named("runelite.api.base") + HttpUrl provideApiBase(@Named("runelite.api.base") String s) { - return new ChatClient(okHttpClient); + final String prop = System.getProperty("runelite.http-service.url"); + return HttpUrl.get(Strings.isNullOrEmpty(prop) ? s : prop); + } + + @Provides + @Named("runelite.session") + HttpUrl provideSession(@Named("runelite.session") String s) + { + final String prop = System.getProperty("runelite.session.url"); + return HttpUrl.get(Strings.isNullOrEmpty(prop) ? s : prop); + } + + @Provides + @Named("runelite.static.base") + HttpUrl provideStaticBase(@Named("runelite.static.base") String s) + { + final String prop = System.getProperty("runelite.static.url"); + return HttpUrl.get(Strings.isNullOrEmpty(prop) ? s : prop); + } + + @Provides + @Named("runelite.ws") + HttpUrl provideWs(@Named("runelite.ws") String s) + { + final String prop = System.getProperty("runelite.ws.url"); + return HttpUrl.get(Strings.isNullOrEmpty(prop) ? s : prop); } @Provides diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLiteProperties.java b/runelite-client/src/main/java/net/runelite/client/RuneLiteProperties.java index c15287a263..d20808a68c 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLiteProperties.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLiteProperties.java @@ -36,6 +36,8 @@ public class RuneLiteProperties { private static final String RUNELITE_TITLE = "runelite.title"; private static final String RUNELITE_VERSION = "runelite.version"; + private static final String RUNELITE_COMMIT = "runelite.commit"; + private static final String RUNELITE_DIRTY = "runelite.dirty"; private static final String DISCORD_INVITE = "runelite.discord.invite"; private static final String LAUNCHER_VERSION_PROPERTY = "runelite.launcher.version"; private static final String INSECURE_SKIP_TLS_VERIFICATION_PROPERTY = "runelite.insecure-skip-tls-verification"; @@ -46,6 +48,7 @@ public class RuneLiteProperties private static final String JAV_CONFIG_BACKUP = "runelite.jav_config_backup"; private static final String PLUGINHUB_BASE = "runelite.pluginhub.url"; private static final String PLUGINHUB_VERSION = "runelite.pluginhub.version"; + private static final String API_BASE = "runelite.api.base"; @Getter(AccessLevel.PACKAGE) private static final Properties properties = new Properties(); @@ -78,6 +81,16 @@ public class RuneLiteProperties return properties.getProperty(RUNELITE_VERSION); } + public static String getCommit() + { + return properties.getProperty(RUNELITE_COMMIT); + } + + public static boolean isDirty() + { + return Boolean.parseBoolean(properties.getProperty(RUNELITE_DIRTY)); + } + public static String getDiscordInvite() { return properties.getProperty(DISCORD_INVITE); @@ -124,4 +137,9 @@ public class RuneLiteProperties String version = System.getProperty(PLUGINHUB_VERSION, properties.getProperty(PLUGINHUB_VERSION)); return HttpUrl.parse(properties.get(PLUGINHUB_BASE) + "/" + version); } + + public static String getApiBase() + { + return properties.getProperty(API_BASE); + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/SessionClient.java b/runelite-client/src/main/java/net/runelite/client/SessionClient.java index 5ea3a116d3..4eb8566a6c 100644 --- a/runelite-client/src/main/java/net/runelite/client/SessionClient.java +++ b/runelite-client/src/main/java/net/runelite/client/SessionClient.java @@ -31,6 +31,8 @@ import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.UUID; import lombok.AllArgsConstructor; +import javax.inject.Inject; +import javax.inject.Named; import net.runelite.http.api.RuneLiteAPI; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; @@ -42,11 +44,19 @@ import okhttp3.ResponseBody; @AllArgsConstructor class SessionClient { - private final OkHttpClient okHttpClient; + private final OkHttpClient client; + private final HttpUrl sessionUrl; + + @Inject + private SessionClient(OkHttpClient client, @Named("runelite.session") HttpUrl sessionUrl) + { + this.client = client; + this.sessionUrl = sessionUrl; + } UUID open() throws IOException { - HttpUrl url = RuneLiteAPI.getSessionBase().newBuilder() + HttpUrl url = sessionUrl.newBuilder() .build(); Request request = new Request.Builder() @@ -54,10 +64,10 @@ class SessionClient .url(url) .build(); - try (Response response = okHttpClient.newCall(request).execute()) + try (Response response = client.newCall(request).execute()) { ResponseBody body = response.body(); - + InputStream in = body.byteStream(); return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), UUID.class); } @@ -69,7 +79,7 @@ class SessionClient void ping(UUID uuid, boolean loggedIn) throws IOException { - HttpUrl url = RuneLiteAPI.getSessionBase().newBuilder() + HttpUrl url = sessionUrl.newBuilder() .addPathSegment("ping") .addQueryParameter("session", uuid.toString()) .addQueryParameter("logged-in", String.valueOf(loggedIn)) @@ -80,7 +90,7 @@ class SessionClient .url(url) .build(); - try (Response response = okHttpClient.newCall(request).execute()) + try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) { @@ -91,7 +101,7 @@ class SessionClient void delete(UUID uuid) throws IOException { - HttpUrl url = RuneLiteAPI.getSessionBase().newBuilder() + HttpUrl url = sessionUrl.newBuilder() .addQueryParameter("session", uuid.toString()) .build(); @@ -100,6 +110,6 @@ class SessionClient .url(url) .build(); - okHttpClient.newCall(request).execute().close(); + client.newCall(request).execute().close(); } } diff --git a/http-api/src/main/java/net/runelite/http/api/account/AccountClient.java b/runelite-client/src/main/java/net/runelite/client/account/AccountClient.java similarity index 87% rename from http-api/src/main/java/net/runelite/http/api/account/AccountClient.java rename to runelite-client/src/main/java/net/runelite/client/account/AccountClient.java index ff999c6d71..4c26a60170 100644 --- a/http-api/src/main/java/net/runelite/http/api/account/AccountClient.java +++ b/runelite-client/src/main/java/net/runelite/client/account/AccountClient.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.account; +package net.runelite.client.account; import com.google.gson.JsonParseException; import java.io.IOException; @@ -30,29 +30,36 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.UUID; -import lombok.RequiredArgsConstructor; +import javax.inject.Inject; +import javax.inject.Named; +import lombok.Setter; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.RuneLiteAPI; +import net.runelite.http.api.account.OAuthResponse; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @Slf4j -@RequiredArgsConstructor public class AccountClient { private final OkHttpClient client; + private final HttpUrl apiBase; + + @Setter private UUID uuid; - public void setUuid(UUID uuid) + @Inject + private AccountClient(OkHttpClient client, @Named("runelite.api.base") HttpUrl apiBase) { - this.uuid = uuid; + this.client = client; + this.apiBase = apiBase; } public OAuthResponse login() throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("account") .addPathSegment("login") .addQueryParameter("uuid", uuid.toString()) @@ -77,7 +84,7 @@ public class AccountClient public void logout() throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("account") .addPathSegment("logout") .build(); @@ -97,7 +104,7 @@ public class AccountClient public boolean sessionCheck() { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("account") .addPathSegment("session-check") .build(); diff --git a/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java b/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java index 90c4c0c32d..7c7fb132a2 100644 --- a/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java +++ b/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java @@ -47,10 +47,8 @@ import net.runelite.client.events.SessionClose; import net.runelite.client.events.SessionOpen; import net.runelite.client.util.LinkBrowser; import net.runelite.client.ws.WSClient; -import net.runelite.http.api.account.AccountClient; import net.runelite.http.api.account.OAuthResponse; import net.runelite.http.api.ws.messages.LoginResponse; -import okhttp3.OkHttpClient; @Singleton @Slf4j @@ -72,14 +70,14 @@ public class SessionManager ConfigManager configManager, EventBus eventBus, WSClient wsClient, - OkHttpClient okHttpClient, + AccountClient accountClient, Gson gson) { this.configManager = configManager; this.eventBus = eventBus; this.wsClient = wsClient; this.sessionFile = sessionfile; - this.accountClient = new AccountClient(okHttpClient); + this.accountClient = accountClient; this.gson = gson; eventBus.register(this); diff --git a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java b/runelite-client/src/main/java/net/runelite/client/chat/ChatClient.java similarity index 91% rename from http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java rename to runelite-client/src/main/java/net/runelite/client/chat/ChatClient.java index 06ca9bb623..2b599b47e0 100644 --- a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java +++ b/runelite-client/src/main/java/net/runelite/client/chat/ChatClient.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.chat; +package net.runelite.client.chat; import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; @@ -32,22 +32,33 @@ import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Set; -import lombok.AllArgsConstructor; +import javax.inject.Inject; +import javax.inject.Named; import net.runelite.http.api.RuneLiteAPI; +import net.runelite.http.api.chat.Duels; +import net.runelite.http.api.chat.LayoutRoom; +import net.runelite.http.api.chat.Task; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; -@AllArgsConstructor public class ChatClient { private final OkHttpClient client; + private final HttpUrl apiBase; + + @Inject + private ChatClient(OkHttpClient client, @Named("runelite.api.base") HttpUrl apiBase) + { + this.client = client; + this.apiBase = apiBase; + } public boolean submitKc(String username, String boss, int kc) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("kc") .addQueryParameter("name", username) @@ -68,7 +79,7 @@ public class ChatClient public int getKc(String username, String boss) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("kc") .addQueryParameter("name", username) @@ -91,7 +102,7 @@ public class ChatClient public boolean submitQp(String username, int qp) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("qp") .addQueryParameter("name", username) @@ -111,7 +122,7 @@ public class ChatClient public int getQp(String username) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("qp") .addQueryParameter("name", username) @@ -133,7 +144,7 @@ public class ChatClient public boolean submitTask(String username, String task, int amount, int initialAmount, String location) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("task") .addQueryParameter("name", username) @@ -156,7 +167,7 @@ public class ChatClient public Task getTask(String username) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("task") .addQueryParameter("name", username) @@ -184,7 +195,7 @@ public class ChatClient public boolean submitPb(String username, String boss, double pb) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("pb") .addQueryParameter("name", username) @@ -205,7 +216,7 @@ public class ChatClient public double getPb(String username, String boss) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("pb") .addQueryParameter("name", username) @@ -228,7 +239,7 @@ public class ChatClient public boolean submitGc(String username, int gc) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("gc") .addQueryParameter("name", username) @@ -248,7 +259,7 @@ public class ChatClient public int getGc(String username) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("gc") .addQueryParameter("name", username) @@ -270,7 +281,7 @@ public class ChatClient public boolean submitDuels(String username, int wins, int losses, int winningStreak, int losingStreak) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("duels") .addQueryParameter("name", username) @@ -293,7 +304,7 @@ public class ChatClient public Duels getDuels(String username) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("duels") .addQueryParameter("name", username) @@ -321,7 +332,7 @@ public class ChatClient public boolean submitLayout(String username, LayoutRoom[] rooms) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("layout") .addQueryParameter("name", username) @@ -340,7 +351,7 @@ public class ChatClient public LayoutRoom[] getLayout(String username) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("layout") .addQueryParameter("name", username) @@ -368,7 +379,7 @@ public class ChatClient public boolean submitPetList(String username, Collection petList) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("pets") .addQueryParameter("name", username) @@ -387,7 +398,7 @@ public class ChatClient public Set getPetList(String username) throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("chat") .addPathSegment("pets") .addQueryParameter("name", username) diff --git a/http-api/src/main/java/net/runelite/http/api/config/ConfigClient.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigClient.java similarity index 91% rename from http-api/src/main/java/net/runelite/http/api/config/ConfigClient.java rename to runelite-client/src/main/java/net/runelite/client/config/ConfigClient.java index b66b802399..a973d3c9a8 100644 --- a/http-api/src/main/java/net/runelite/http/api/config/ConfigClient.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigClient.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.config; +package net.runelite.client.config; import com.google.gson.Gson; import com.google.gson.JsonParseException; @@ -32,9 +32,12 @@ import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.UUID; import java.util.concurrent.CompletableFuture; -import lombok.AllArgsConstructor; +import javax.inject.Inject; +import javax.inject.Named; +import lombok.Setter; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.RuneLiteAPI; +import net.runelite.http.api.config.Configuration; import okhttp3.Call; import okhttp3.Callback; import okhttp3.HttpUrl; @@ -44,7 +47,6 @@ import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; -@AllArgsConstructor @Slf4j public class ConfigClient { @@ -52,11 +54,21 @@ public class ConfigClient private static final Gson GSON = RuneLiteAPI.GSON; private final OkHttpClient client; - private final UUID uuid; + private final HttpUrl apiBase; + + @Setter + private UUID uuid; + + @Inject + private ConfigClient(OkHttpClient client, @Named("runelite.api.base") HttpUrl apiBase) + { + this.client = client; + this.apiBase = apiBase; + } public Configuration get() throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("config") .build(); @@ -82,7 +94,7 @@ public class ConfigClient { CompletableFuture future = new CompletableFuture<>(); - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("config") .addPathSegment(key) .build(); @@ -120,7 +132,7 @@ public class ConfigClient { CompletableFuture future = new CompletableFuture<>(); - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("config") .build(); @@ -173,7 +185,7 @@ public class ConfigClient { CompletableFuture future = new CompletableFuture<>(); - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("config") .addPathSegment(key) .build(); diff --git a/runelite-client/src/main/java/net/runelite/client/externalplugins/ExternalPluginClient.java b/runelite-client/src/main/java/net/runelite/client/externalplugins/ExternalPluginClient.java index d101cc22bb..6bea4781c3 100644 --- a/runelite-client/src/main/java/net/runelite/client/externalplugins/ExternalPluginClient.java +++ b/runelite-client/src/main/java/net/runelite/client/externalplugins/ExternalPluginClient.java @@ -44,6 +44,7 @@ import java.util.List; import java.util.Map; import javax.imageio.ImageIO; import javax.inject.Inject; +import javax.inject.Named; import lombok.extern.slf4j.Slf4j; import net.runelite.client.RuneLiteProperties; import net.runelite.client.util.VerificationException; @@ -62,12 +63,17 @@ public class ExternalPluginClient { private final OkHttpClient okHttpClient; private final Gson gson; + private final HttpUrl apiBase; @Inject - private ExternalPluginClient(OkHttpClient okHttpClient, Gson gson) + private ExternalPluginClient(OkHttpClient okHttpClient, + Gson gson, + @Named("runelite.api.base") HttpUrl apiBase + ) { this.okHttpClient = okHttpClient; this.gson = gson; + this.apiBase = apiBase; } public List downloadManifest() throws IOException, VerificationException @@ -153,7 +159,7 @@ public class ExternalPluginClient return; } - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("pluginhub") .build(); @@ -181,7 +187,7 @@ public class ExternalPluginClient public Map getPluginCounts() throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase() + HttpUrl url = apiBase .newBuilder() .addPathSegments("pluginhub") .build(); diff --git a/http-api/src/main/java/net/runelite/http/api/item/ItemClient.java b/runelite-client/src/main/java/net/runelite/client/game/ItemClient.java similarity index 84% rename from http-api/src/main/java/net/runelite/http/api/item/ItemClient.java rename to runelite-client/src/main/java/net/runelite/client/game/ItemClient.java index d9cf5c1665..c2d1cfb4b9 100644 --- a/http-api/src/main/java/net/runelite/http/api/item/ItemClient.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemClient.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.item; +package net.runelite.client.game; import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; @@ -32,9 +32,12 @@ import java.io.InputStreamReader; import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; import java.util.Map; -import lombok.AllArgsConstructor; +import javax.inject.Inject; +import javax.inject.Named; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.RuneLiteAPI; +import net.runelite.http.api.item.ItemPrice; +import net.runelite.http.api.item.ItemStats; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -45,12 +48,24 @@ import okhttp3.Response; public class ItemClient { private final OkHttpClient client; + private final HttpUrl apiBase, staticBase; + + @Inject + private ItemClient(OkHttpClient client, + @Named("runelite.api.base") HttpUrl apiBase, + @Named("runelite.static.base") HttpUrl staticBase + ) + { + this.client = client; + this.apiBase = apiBase; + this.staticBase = staticBase; + } public ItemPrice[] getPrices() throws IOException { - HttpUrl.Builder urlBuilder = RuneLiteAPI.getApiBase().newBuilder() - .addPathSegment("item") - .addPathSegment("prices.js"); + HttpUrl.Builder urlBuilder = apiBase.newBuilder() + .addPathSegment("item") + .addPathSegment("prices.js"); HttpUrl url = urlBuilder.build(); @@ -79,7 +94,7 @@ public class ItemClient public Map getStats() throws IOException { - HttpUrl.Builder urlBuilder = RuneLiteAPI.getStaticBase().newBuilder() + HttpUrl.Builder urlBuilder = staticBase.newBuilder() .addPathSegment("item") // TODO: Change this to stats.min.json later after release is undeployed .addPathSegment("stats.ids.min.json"); diff --git a/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java b/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java index 3f112d6cc7..0c19310acc 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java @@ -56,10 +56,8 @@ import net.runelite.api.SpritePixels; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.util.AsyncBufferedImage; -import net.runelite.http.api.item.ItemClient; import net.runelite.http.api.item.ItemPrice; import net.runelite.http.api.item.ItemStats; -import okhttp3.OkHttpClient; @Singleton @Slf4j @@ -168,11 +166,11 @@ public class ItemManager @Inject public ItemManager(Client client, ScheduledExecutorService scheduledExecutorService, ClientThread clientThread, - OkHttpClient okHttpClient, RuneLiteConfig runeLiteConfig) + ItemClient itemClient, RuneLiteConfig runeLiteConfig) { this.client = client; this.clientThread = clientThread; - this.itemClient = new ItemClient(okHttpClient); + this.itemClient = itemClient; this.runeLiteConfig = runeLiteConfig; scheduledExecutorService.scheduleWithFixedDelay(this::loadPrices, 0, 30, TimeUnit.MINUTES); diff --git a/runelite-client/src/main/java/net/runelite/client/game/NPCManager.java b/runelite-client/src/main/java/net/runelite/client/game/NPCManager.java index 1a51afea3f..c1d182be38 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/NPCManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/NPCManager.java @@ -32,21 +32,18 @@ import javax.annotation.Nullable; import javax.inject.Inject; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; -import net.runelite.http.api.npc.NpcInfo; -import net.runelite.http.api.npc.NpcInfoClient; -import okhttp3.OkHttpClient; @Singleton @Slf4j public class NPCManager { - private final OkHttpClient okHttpClient; + private final NpcInfoClient npcInfoClient; private Map npcMap = Collections.emptyMap(); @Inject - private NPCManager(OkHttpClient okHttpClient, ScheduledExecutorService scheduledExecutorService) + private NPCManager(NpcInfoClient npcInfoClient, ScheduledExecutorService scheduledExecutorService) { - this.okHttpClient = okHttpClient; + this.npcInfoClient = npcInfoClient; scheduledExecutorService.execute(this::loadNpcs); } @@ -67,7 +64,7 @@ public class NPCManager { try { - npcMap = new NpcInfoClient(okHttpClient).getNpcs(); + npcMap = npcInfoClient.getNpcs(); } catch (IOException e) { diff --git a/http-api/src/main/java/net/runelite/http/api/npc/NpcInfo.java b/runelite-client/src/main/java/net/runelite/client/game/NpcInfo.java similarity index 97% rename from http-api/src/main/java/net/runelite/http/api/npc/NpcInfo.java rename to runelite-client/src/main/java/net/runelite/client/game/NpcInfo.java index 091f36e471..c33832c75c 100644 --- a/http-api/src/main/java/net/runelite/http/api/npc/NpcInfo.java +++ b/runelite-client/src/main/java/net/runelite/client/game/NpcInfo.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.npc; +package net.runelite.client.game; import lombok.Data; diff --git a/http-api/src/main/java/net/runelite/http/api/npc/NpcInfoClient.java b/runelite-client/src/main/java/net/runelite/client/game/NpcInfoClient.java similarity index 88% rename from http-api/src/main/java/net/runelite/http/api/npc/NpcInfoClient.java rename to runelite-client/src/main/java/net/runelite/client/game/NpcInfoClient.java index d7c4396625..aa625e4928 100644 --- a/http-api/src/main/java/net/runelite/http/api/npc/NpcInfoClient.java +++ b/runelite-client/src/main/java/net/runelite/client/game/NpcInfoClient.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.npc; +package net.runelite.client.game; import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; @@ -32,7 +32,8 @@ import java.io.InputStreamReader; import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; import java.util.Map; -import lombok.Value; +import javax.inject.Inject; +import javax.inject.Named; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.RuneLiteAPI; import okhttp3.HttpUrl; @@ -41,14 +42,21 @@ import okhttp3.Request; import okhttp3.Response; @Slf4j -@Value public class NpcInfoClient { private final OkHttpClient client; + private final HttpUrl staticBase; + + @Inject + private NpcInfoClient(OkHttpClient client, @Named("runelite.static.base") HttpUrl staticBase) + { + this.client = client; + this.staticBase = staticBase; + } public Map getNpcs() throws IOException { - HttpUrl.Builder urlBuilder = RuneLiteAPI.getStaticBase().newBuilder() + HttpUrl.Builder urlBuilder = staticBase.newBuilder() .addPathSegment("npcs") .addPathSegment("npcs.min.json"); diff --git a/http-api/src/main/java/net/runelite/http/api/worlds/WorldClient.java b/runelite-client/src/main/java/net/runelite/client/game/WorldClient.java similarity index 94% rename from http-api/src/main/java/net/runelite/http/api/worlds/WorldClient.java rename to runelite-client/src/main/java/net/runelite/client/game/WorldClient.java index d6e0865f14..9c0c442a0f 100644 --- a/http-api/src/main/java/net/runelite/http/api/worlds/WorldClient.java +++ b/runelite-client/src/main/java/net/runelite/client/game/WorldClient.java @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.worlds; +package net.runelite.client.game; import com.google.gson.JsonParseException; import java.io.IOException; @@ -33,6 +33,7 @@ import java.nio.charset.StandardCharsets; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.RuneLiteAPI; +import net.runelite.http.api.worlds.WorldResult; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -43,10 +44,11 @@ import okhttp3.Response; public class WorldClient { private final OkHttpClient client; + private final HttpUrl apiBase; public WorldResult lookupWorlds() throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("worlds.js") .build(); diff --git a/runelite-client/src/main/java/net/runelite/client/game/WorldService.java b/runelite-client/src/main/java/net/runelite/client/game/WorldService.java index 8f2a6a691b..8088b76829 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/WorldService.java +++ b/runelite-client/src/main/java/net/runelite/client/game/WorldService.java @@ -33,6 +33,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import javax.annotation.Nullable; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; @@ -41,8 +42,8 @@ import net.runelite.client.eventbus.EventBus; import net.runelite.client.events.WorldsFetch; import net.runelite.client.util.RunnableExceptionLogger; import net.runelite.http.api.worlds.World; -import net.runelite.http.api.worlds.WorldClient; import net.runelite.http.api.worlds.WorldResult; +import okhttp3.HttpUrl; import okhttp3.OkHttpClient; @Singleton @@ -61,11 +62,11 @@ public class WorldService @Inject private WorldService(@Nullable Client client, ScheduledExecutorService scheduledExecutorService, OkHttpClient okHttpClient, - EventBus eventBus) + @Named("runelite.api.base") HttpUrl apiBase, EventBus eventBus) { this.client = client; this.scheduledExecutorService = scheduledExecutorService; - this.worldClient = new WorldClient(okHttpClient); + this.worldClient = new WorldClient(okHttpClient, apiBase); this.eventBus = eventBus; scheduledExecutorService.scheduleWithFixedDelay(RunnableExceptionLogger.wrap(this::tick), 0, WORLD_FETCH_TIMER, TimeUnit.MINUTES); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 4105a926a5..4973401812 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -73,6 +73,7 @@ import static net.runelite.api.widgets.WidgetID.DIARY_QUEST_GROUP_ID; import static net.runelite.api.widgets.WidgetID.KILL_LOGS_GROUP_ID; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.callback.ClientThread; +import net.runelite.client.chat.ChatClient; import net.runelite.client.chat.ChatColorType; import net.runelite.client.chat.ChatCommandManager; import net.runelite.client.chat.ChatMessageBuilder; @@ -93,7 +94,6 @@ import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.util.ImageUtil; import net.runelite.client.util.QuantityFormatter; import net.runelite.client.util.Text; -import net.runelite.http.api.chat.ChatClient; import net.runelite.http.api.chat.Duels; import net.runelite.http.api.item.ItemPrice; import okhttp3.OkHttpClient; diff --git a/http-api/src/main/java/net/runelite/http/api/feed/FeedClient.java b/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedClient.java similarity index 86% rename from http-api/src/main/java/net/runelite/http/api/feed/FeedClient.java rename to runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedClient.java index a0b628df33..f1b2506393 100644 --- a/http-api/src/main/java/net/runelite/http/api/feed/FeedClient.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedClient.java @@ -22,30 +22,39 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.feed; +package net.runelite.client.plugins.feed; import com.google.gson.JsonParseException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; -import lombok.RequiredArgsConstructor; +import javax.inject.Inject; +import javax.inject.Named; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.RuneLiteAPI; +import net.runelite.http.api.feed.FeedResult; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @Slf4j -@RequiredArgsConstructor public class FeedClient { private final OkHttpClient client; + private final HttpUrl apiBase; + + @Inject + private FeedClient(OkHttpClient client, @Named("runelite.api.base") HttpUrl apiBase) + { + this.client = client; + this.apiBase = apiBase; + } public FeedResult lookupFeed() throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("feed.js") .build(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPlugin.java index ebe607d986..f315f59374 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPlugin.java @@ -45,9 +45,7 @@ import net.runelite.client.task.Schedule; import net.runelite.client.ui.ClientToolbar; import net.runelite.client.ui.NavigationButton; import net.runelite.client.util.ImageUtil; -import net.runelite.http.api.feed.FeedClient; import net.runelite.http.api.feed.FeedResult; -import okhttp3.OkHttpClient; @PluginDescriptor( name = "News Feed", @@ -145,10 +143,4 @@ public class FeedPlugin extends Plugin { return configManager.getConfig(FeedConfig.class); } - - @Provides - FeedClient provideFeedClient(OkHttpClient okHttpClient) - { - return new FeedClient(okHttpClient); - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index 062c810ffa..869ac73eef 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -44,9 +44,13 @@ import com.jogamp.opengl.GLFBODrawable; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.math.Matrix4; import java.awt.Canvas; +import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Image; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; @@ -293,6 +297,24 @@ public class GpuPlugin extends Plugin implements DrawCallbacks private int uniSmoothBanding; private int uniTextureLightMode; + private int needsReset; + + private final ComponentListener resizeListener = new ComponentAdapter() + { + @Override + public void componentResized(ComponentEvent e) + { + // forward to the JAWTWindow component listener on the canvas. The JAWTWindow component + // listener listens for resizes or movement of the component in order to resize and move + // the associated offscreen layer (calayer on macos only) + canvas.dispatchEvent(e); + // resetSize needs to be run awhile after the resize is completed. + // I've tried waiting until all EDT events are completed and even that is too soon. + // Not sure why, so we just wait a few frames. + needsReset = 5; + } + }; + @Override protected void startUp() { @@ -447,6 +469,12 @@ public class GpuPlugin extends Plugin implements DrawCallbacks { invokeOnMainThread(this::uploadScene); } + + if (OSType.getOSType() == OSType.MacOS) + { + SwingUtilities.invokeAndWait(() -> ((Component) client).addComponentListener(resizeListener)); + needsReset = 5; // plugin startup races with ClientUI positioning, so do a reset in a little bit + } } catch (Throwable e) { @@ -474,6 +502,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks @Override protected void shutDown() { + ((Component) client).removeComponentListener(resizeListener); clientThread.invoke(() -> { client.setGpu(false); @@ -1091,16 +1120,22 @@ public class GpuPlugin extends Plugin implements DrawCallbacks gl.glBindTexture(gl.GL_TEXTURE_2D, interfaceTexture); gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA, canvasWidth, canvasHeight, 0, gl.GL_BGRA, gl.GL_UNSIGNED_BYTE, null); gl.glBindTexture(gl.GL_TEXTURE_2D, 0); + } - if (OSType.getOSType() == OSType.MacOS && glDrawable instanceof GLFBODrawable) + if (needsReset > 0) + { + assert OSType.getOSType() == OSType.MacOS; + if (needsReset == 1 && glDrawable instanceof GLFBODrawable) { // GLDrawables created with createGLDrawable() do not have a resize listener // I don't know why this works with Windows/Linux, but on OSX // it prevents JOGL from resizing its FBOs and underlying GL textures. So, // we manually trigger a resize here. GLFBODrawable glfboDrawable = (GLFBODrawable) glDrawable; + log.debug("Resetting GLFBODrawable size"); glfboDrawable.resetSize(gl); } + needsReset--; } final BufferProvider bufferProvider = client.getBufferProvider(); diff --git a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeClient.java similarity index 87% rename from http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java rename to runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeClient.java index 1d898ccf27..c50043ea80 100644 --- a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeClient.java @@ -22,16 +22,18 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.ge; +package net.runelite.client.plugins.grandexchange; import com.google.gson.Gson; import java.io.IOException; import java.util.UUID; -import lombok.RequiredArgsConstructor; +import javax.inject.Inject; +import javax.inject.Named; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.RuneLiteAPI; import static net.runelite.http.api.RuneLiteAPI.JSON; +import net.runelite.http.api.ge.GrandExchangeTrade; import okhttp3.Call; import okhttp3.Callback; import okhttp3.HttpUrl; @@ -41,21 +43,28 @@ import okhttp3.RequestBody; import okhttp3.Response; @Slf4j -@RequiredArgsConstructor public class GrandExchangeClient { private static final Gson GSON = RuneLiteAPI.GSON; private final OkHttpClient client; + private final HttpUrl apiBase; @Setter private UUID uuid; @Setter private String machineId; + @Inject + private GrandExchangeClient(OkHttpClient client, @Named("runelite.api.base") HttpUrl apiBase) + { + this.client = client; + this.apiBase = apiBase; + } + public void submit(GrandExchangeTrade grandExchangeTrade) { - final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + final HttpUrl url = apiBase.newBuilder() .addPathSegment("ge") .build(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java index 3728bad6dd..63f2c84669 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java @@ -100,11 +100,9 @@ import net.runelite.client.util.LinkBrowser; import net.runelite.client.util.OSType; import net.runelite.client.util.QuantityFormatter; import net.runelite.client.util.Text; -import net.runelite.http.api.ge.GrandExchangeClient; import net.runelite.http.api.ge.GrandExchangeTrade; import net.runelite.http.api.item.ItemStats; import net.runelite.http.api.worlds.WorldType; -import okhttp3.OkHttpClient; import org.apache.commons.lang3.time.DurationFormatUtils; import org.apache.commons.text.similarity.FuzzyScore; @@ -259,12 +257,6 @@ public class GrandExchangePlugin extends Plugin return configManager.getConfig(GrandExchangeConfig.class); } - @Provides - GrandExchangeClient provideGrandExchangeClient(OkHttpClient okHttpClient) - { - return new GrandExchangeClient(okHttpClient); - } - @Override protected void startUp() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java index 662316eb93..25338d4285 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java @@ -800,7 +800,7 @@ public class GroundItemsPlugin extends Plugin Lootbeam lootbeam = lootbeams.get(worldPoint); if (lootbeam == null) { - lootbeam = new Lootbeam(client, worldPoint, color); + lootbeam = new Lootbeam(client, clientThread, worldPoint, color); lootbeams.put(worldPoint, lootbeam); } else diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/Lootbeam.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/Lootbeam.java index 1d95a39dc1..9e8761a93f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/Lootbeam.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/Lootbeam.java @@ -27,10 +27,12 @@ package net.runelite.client.plugins.grounditems; import net.runelite.api.AnimationID; import net.runelite.api.Client; import net.runelite.api.JagexColor; +import net.runelite.api.Model; import net.runelite.api.RuneLiteObject; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; import java.awt.Color; +import net.runelite.client.callback.ClientThread; class Lootbeam { @@ -39,11 +41,13 @@ class Lootbeam private final RuneLiteObject runeLiteObject; private final Client client; + private final ClientThread clientThread; private Color color; - public Lootbeam(Client client, WorldPoint worldPoint, Color color) + public Lootbeam(Client client, ClientThread clientThread, WorldPoint worldPoint, Color color) { this.client = client; + this.clientThread = clientThread; runeLiteObject = client.createRuneLiteObject(); setColor(color); @@ -64,11 +68,21 @@ class Lootbeam } this.color = color; - runeLiteObject.setModel(client.loadModel( - RAID_LIGHT_MODEL, - new short[]{RAID_LIGHT_FIND_COLOR}, - new short[]{JagexColor.rgbToHSL(color.getRGB(), 1.0d)} - )); + clientThread.invoke(() -> + { + Model m = client.loadModel( + RAID_LIGHT_MODEL, + new short[]{RAID_LIGHT_FIND_COLOR}, + new short[]{JagexColor.rgbToHSL(color.getRGB(), 1.0d)} + ); + if (m == null) + { + return false; + } + + runeLiteObject.setModel(m); + return true; + }); } public void remove() diff --git a/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerClient.java similarity index 89% rename from http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java rename to runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerClient.java index 4fc68a6ba5..1f4d99c549 100644 --- a/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerClient.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.loottracker; +package net.runelite.client.plugins.loottracker; import com.google.gson.Gson; import com.google.gson.JsonParseException; @@ -35,12 +35,15 @@ import java.util.Collection; import java.util.List; import java.util.UUID; import java.util.concurrent.CompletableFuture; +import javax.inject.Inject; +import javax.inject.Named; import lombok.Getter; -import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.RuneLiteAPI; import static net.runelite.http.api.RuneLiteAPI.JSON; +import net.runelite.http.api.loottracker.LootAggregate; +import net.runelite.http.api.loottracker.LootRecord; import okhttp3.Call; import okhttp3.Callback; import okhttp3.HttpUrl; @@ -50,21 +53,29 @@ import okhttp3.RequestBody; import okhttp3.Response; @Slf4j -@RequiredArgsConstructor public class LootTrackerClient { private static final Gson GSON = RuneLiteAPI.GSON; private final OkHttpClient client; + private final HttpUrl apiBase; + @Getter @Setter private UUID uuid; + @Inject + private LootTrackerClient(OkHttpClient client, @Named("runelite.api.base") HttpUrl apiBase) + { + this.client = client; + this.apiBase = apiBase; + } + public CompletableFuture submit(Collection lootRecords) { CompletableFuture future = new CompletableFuture<>(); - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("loottracker") .build(); @@ -107,7 +118,7 @@ public class LootTrackerClient public Collection get() throws IOException { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("loottracker") .build(); @@ -137,7 +148,7 @@ public class LootTrackerClient public void delete(String eventId) { - HttpUrl.Builder builder = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl.Builder builder = apiBase.newBuilder() .addPathSegment("loottracker"); if (eventId != null) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java index a3d500dc49..654d7db9b1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java @@ -65,7 +65,6 @@ import net.runelite.client.util.ImageUtil; import net.runelite.client.util.QuantityFormatter; import net.runelite.client.util.SwingUtil; import net.runelite.http.api.loottracker.LootRecordType; -import net.runelite.http.api.loottracker.LootTrackerClient; class LootTrackerPanel extends PluginPanel { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index b29c67be58..056022045c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -114,8 +114,6 @@ import net.runelite.http.api.loottracker.GameItem; import net.runelite.http.api.loottracker.LootAggregate; import net.runelite.http.api.loottracker.LootRecord; import net.runelite.http.api.loottracker.LootRecordType; -import net.runelite.http.api.loottracker.LootTrackerClient; -import okhttp3.OkHttpClient; import org.apache.commons.text.WordUtils; @PluginDescriptor( @@ -340,12 +338,6 @@ public class LootTrackerPlugin extends Plugin return list; } - @Provides - LootTrackerClient provideLootTrackerClient(OkHttpClient okHttpClient) - { - return new LootTrackerClient(okHttpClient); - } - @Provides LootTrackerConfig provideConfig(ConfigManager configManager) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 3cc468a39d..4722d85d85 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -67,6 +67,7 @@ import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.VarbitChanged; import net.runelite.client.callback.ClientThread; +import net.runelite.client.chat.ChatClient; import net.runelite.client.chat.ChatColorType; import net.runelite.client.chat.ChatCommandManager; import net.runelite.client.chat.ChatMessageBuilder; @@ -96,7 +97,6 @@ import static net.runelite.client.util.Text.sanitize; import net.runelite.client.ws.PartyMember; import net.runelite.client.ws.PartyService; import net.runelite.client.ws.WSClient; -import net.runelite.http.api.chat.ChatClient; import net.runelite.http.api.chat.LayoutRoom; import net.runelite.http.api.ws.messages.party.PartyChatMessage; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalConfig.java index 39bf615853..4a32c41b36 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalConfig.java @@ -27,16 +27,32 @@ package net.runelite.client.plugins.roofremoval; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.ConfigSection; @ConfigGroup(RoofRemovalConfig.CONFIG_GROUP) public interface RoofRemovalConfig extends Config { String CONFIG_GROUP = "roofremoval"; + @ConfigSection( + name = "Modes", + description = "In what situations should roofs be removed", + position = 0 + ) + String modesSection = "modes"; + + @ConfigSection( + name = "Area Overrides", + description = "Always remove roofs in specific areas", + position = 1 + ) + String overridesSection = "overrides"; + @ConfigItem( keyName = "removePosition", name = "Player's position", - description = "Remove roofs above the player's position" + description = "Remove roofs above the player's position", + section = modesSection ) default boolean removePosition() { @@ -46,7 +62,8 @@ public interface RoofRemovalConfig extends Config @ConfigItem( keyName = "removeHovered", name = "Hovered tile", - description = "Remove roofs above the hovered tile" + description = "Remove roofs above the hovered tile", + section = modesSection ) default boolean removeHovered() { @@ -56,7 +73,8 @@ public interface RoofRemovalConfig extends Config @ConfigItem( keyName = "removeDestination", name = "Destination tile", - description = "Remove roofs above the destination tile" + description = "Remove roofs above the destination tile", + section = modesSection ) default boolean removeDestination() { @@ -66,10 +84,22 @@ public interface RoofRemovalConfig extends Config @ConfigItem( keyName = "removeBetween", name = "Between camera & player", - description = "Remove roofs between the camera and the player at low camera angles" + description = "Remove roofs between the camera and the player at low camera angles", + section = modesSection ) default boolean removeBetween() { return true; } + + @ConfigItem( + keyName = "overridePOH", + name = "Player Owned House", + description = "Always remove roofs while in the Player Owned House", + section = overridesSection + ) + default boolean overridePOH() + { + return false; + } } diff --git a/http-api/src/main/java/net/runelite/http/api/worlds/WorldResult.java b/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalConfigOverride.java similarity index 71% rename from http-api/src/main/java/net/runelite/http/api/worlds/WorldResult.java rename to runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalConfigOverride.java index a4afe23e85..478f61ee4b 100644 --- a/http-api/src/main/java/net/runelite/http/api/worlds/WorldResult.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalConfigOverride.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Adam + * Copyright (c) 2021 Hydrox6 * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,33 +22,24 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.worlds; +package net.runelite.client.plugins.roofremoval; +import lombok.Getter; +import java.util.Arrays; import java.util.List; +import java.util.function.Predicate; -public class WorldResult +@Getter +enum RoofRemovalConfigOverride { - private List worlds; + POH(RoofRemovalConfig::overridePOH, 7257, 7513, 7514, 7769, 7770, 8025, 8026); - public List getWorlds() - { - return worlds; - } + private final Predicate enabled; + private final List regions; - public void setWorlds(List worlds) + RoofRemovalConfigOverride(Predicate enabled, Integer... regions) { - this.worlds = worlds; - } - - public World findWorld(int worldNum) - { - for (World world : worlds) - { - if (world.getId() == worldNum) - { - return world; - } - } - return null; + this.enabled = enabled; + this.regions = Arrays.asList(regions); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalPlugin.java index 9f86d9a47e..5d567a90c3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalPlugin.java @@ -34,8 +34,10 @@ import java.io.InputStreamReader; import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; @@ -86,6 +88,7 @@ public class RoofRemovalPlugin extends Plugin private RoofRemovalConfig config; private final Map overrides = new HashMap<>(); + private final Set configOverrideRegions = new HashSet<>(); @Provides RoofRemovalConfig getConfig(ConfigManager configManager) @@ -96,6 +99,7 @@ public class RoofRemovalPlugin extends Plugin @Override public void startUp() throws IOException { + buildConfigOverrides(); loadRoofOverrides(); clientThread.invoke(() -> { @@ -139,7 +143,21 @@ public class RoofRemovalPlugin extends Plugin return; } - client.getScene().setRoofRemovalMode(buildRoofRemovalFlags()); + if (e.getKey().startsWith("remove")) + { + client.getScene().setRoofRemovalMode(buildRoofRemovalFlags()); + } + else if (e.getKey().startsWith("override")) + { + buildConfigOverrides(); + clientThread.invoke(() -> + { + if (client.getGameState() == GameState.LOGGED_IN) + { + client.setGameState(GameState.LOADING); + } + }); + } } private int buildRoofRemovalFlags() @@ -164,6 +182,18 @@ public class RoofRemovalPlugin extends Plugin return roofRemovalMode; } + private void buildConfigOverrides() + { + configOverrideRegions.clear(); + for (RoofRemovalConfigOverride configOverride : RoofRemovalConfigOverride.values()) + { + if (configOverride.getEnabled().test(config)) + { + configOverrideRegions.addAll(configOverride.getRegions()); + } + } + } + private void performRoofRemoval() { assert client.isClientThread(); @@ -218,6 +248,11 @@ public class RoofRemovalPlugin extends Plugin outer: for (int regionID : client.getMapRegions()) { + if (configOverrideRegions.contains(regionID)) + { + regionsHaveOverrides = true; + break; + } for (int z = 0; z < Constants.MAX_Z; z++) { if (overrides.containsKey(regionID << 2 | z)) @@ -250,19 +285,21 @@ public class RoofRemovalPlugin extends Plugin // Properly account for instances shifting worldpoints around final WorldPoint wp = WorldPoint.fromLocalInstance(client, tile.getLocalLocation(), tile.getPlane()); - int regionID = wp.getRegionID() << 2 | z; - if (!overrides.containsKey(regionID)) - { - continue; - } - - int rx = wp.getRegionX(); - int ry = wp.getRegionY(); - long[] region = overrides.get(regionID); - if ((region[ry] & (1L << rx)) != 0) + int regionAndPlane = wp.getRegionID() << 2 | wp.getPlane(); + if (configOverrideRegions.contains(wp.getRegionID())) { settings[z][x][y] |= Constants.TILE_FLAG_UNDER_ROOF; } + else if (overrides.containsKey(regionAndPlane)) + { + int rx = wp.getRegionX(); + int ry = wp.getRegionY(); + long[] region = overrides.get(regionAndPlane); + if ((region[ry] & (1L << rx)) != 0) + { + settings[z][x][y] |= Constants.TILE_FLAG_UNDER_ROOF; + } + } } } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java index 41598f00c4..3b35670873 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java @@ -74,6 +74,7 @@ import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.Notifier; import net.runelite.client.callback.ClientThread; +import net.runelite.client.chat.ChatClient; import net.runelite.client.chat.ChatColorType; import net.runelite.client.chat.ChatCommandManager; import net.runelite.client.chat.ChatMessageBuilder; @@ -91,7 +92,6 @@ import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.util.ColorUtil; import net.runelite.client.util.Text; -import net.runelite.http.api.chat.ChatClient; import org.apache.commons.lang3.ArrayUtils; @PluginDescriptor( diff --git a/http-api/src/main/java/net/runelite/http/api/xp/XpClient.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpClient.java similarity index 88% rename from http-api/src/main/java/net/runelite/http/api/xp/XpClient.java rename to runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpClient.java index 76acf6ad63..d07cec417f 100644 --- a/http-api/src/main/java/net/runelite/http/api/xp/XpClient.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpClient.java @@ -22,11 +22,12 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.xp; +package net.runelite.client.plugins.xptracker; import java.io.IOException; +import javax.inject.Inject; +import javax.inject.Named; import lombok.extern.slf4j.Slf4j; -import net.runelite.http.api.RuneLiteAPI; import okhttp3.Call; import okhttp3.Callback; import okhttp3.HttpUrl; @@ -38,15 +39,18 @@ import okhttp3.Response; public class XpClient { private final OkHttpClient client; + private final HttpUrl apiBase; - public XpClient(OkHttpClient client) + @Inject + private XpClient(OkHttpClient client, @Named("runelite.api.base") HttpUrl apiBase) { this.client = client; + this.apiBase = apiBase; } public void update(String username) { - HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("xp") .addPathSegment("update") .addQueryParameter("username", username) diff --git a/http-api/src/main/java/net/runelite/http/api/xp/XpData.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpData.java similarity index 100% rename from http-api/src/main/java/net/runelite/http/api/xp/XpData.java rename to runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpData.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java index 5407226a99..69ff78aa17 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java @@ -69,8 +69,6 @@ import net.runelite.client.ui.NavigationButton; import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.util.ImageUtil; import net.runelite.client.util.Text; -import net.runelite.http.api.xp.XpClient; -import okhttp3.OkHttpClient; @PluginDescriptor( name = "XP Tracker", @@ -139,12 +137,6 @@ public class XpTrackerPlugin extends Plugin return configManager.getConfig(XpTrackerConfig.class); } - @Provides - XpClient provideXpClient(OkHttpClient okHttpClient) - { - return new XpClient(okHttpClient); - } - @Override public void configure(Binder binder) { diff --git a/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java b/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaClient.java similarity index 86% rename from http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java rename to runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaClient.java index f7672c9ca3..c792aeb490 100644 --- a/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaClient.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.xtea; +package net.runelite.client.plugins.xtea; import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; @@ -31,10 +31,13 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.List; -import lombok.AllArgsConstructor; +import javax.inject.Inject; +import javax.inject.Named; import lombok.extern.slf4j.Slf4j; import net.runelite.http.api.RuneLiteAPI; import static net.runelite.http.api.RuneLiteAPI.JSON; +import net.runelite.http.api.xtea.XteaKey; +import net.runelite.http.api.xtea.XteaRequest; import okhttp3.Call; import okhttp3.Callback; import okhttp3.HttpUrl; @@ -48,19 +51,25 @@ import okhttp3.Response; public class XteaClient { private final OkHttpClient client; + private final HttpUrl apiBase; + + @Inject + private XteaClient(OkHttpClient client, @Named("runelite.api.base") HttpUrl apiBase) + { + this.client = client; + this.apiBase = apiBase; + } public void submit(XteaRequest xteaRequest) { - String json = RuneLiteAPI.GSON.toJson(xteaRequest); - - HttpUrl url = RuneLiteAPI.getXteaBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("xtea") .build(); log.debug("Built URI: {}", url); Request request = new Request.Builder() - .post(RequestBody.create(JSON, json)) + .post(RequestBody.create(JSON, RuneLiteAPI.GSON.toJson(xteaRequest))) .url(url) .build(); @@ -75,7 +84,7 @@ public class XteaClient @Override public void onResponse(Call call, Response response) { - try + try // NOPMD: UseTryWithResources { if (!response.isSuccessful()) { @@ -92,7 +101,7 @@ public class XteaClient public List get() throws IOException { - HttpUrl url = RuneLiteAPI.getXteaBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("xtea") .build(); @@ -115,7 +124,7 @@ public class XteaClient public XteaKey get(int region) throws IOException { - HttpUrl url = RuneLiteAPI.getXteaBase().newBuilder() + HttpUrl url = apiBase.newBuilder() .addPathSegment("xtea") .addPathSegment(Integer.toString(region)) .build(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaPlugin.java index 4eae636114..9fd2df609a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaPlugin.java @@ -24,7 +24,6 @@ */ package net.runelite.client.plugins.xtea; -import com.google.inject.Provides; import java.util.HashSet; import java.util.Set; import javax.inject.Inject; @@ -35,10 +34,8 @@ import net.runelite.api.events.GameStateChanged; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.http.api.xtea.XteaClient; import net.runelite.http.api.xtea.XteaKey; import net.runelite.http.api.xtea.XteaRequest; -import okhttp3.OkHttpClient; @PluginDescriptor( name = "Xtea", @@ -55,12 +52,6 @@ public class XteaPlugin extends Plugin @Inject private XteaClient xteaClient; - @Provides - XteaClient provideXteaClient(OkHttpClient okHttpClient) - { - return new XteaClient(okHttpClient); - } - @Subscribe public void onGameStateChanged(GameStateChanged gameStateChanged) { diff --git a/runelite-client/src/main/java/net/runelite/client/rs/WorldSupplier.java b/runelite-client/src/main/java/net/runelite/client/rs/WorldSupplier.java index 16cf8141ad..26b3139a64 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/WorldSupplier.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/WorldSupplier.java @@ -35,9 +35,11 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import net.runelite.client.RuneLiteProperties; import net.runelite.http.api.worlds.World; -import net.runelite.http.api.worlds.WorldClient; +import net.runelite.client.game.WorldClient; import net.runelite.http.api.worlds.WorldType; +import okhttp3.HttpUrl; import okhttp3.OkHttpClient; @Slf4j @@ -46,7 +48,7 @@ class WorldSupplier implements Supplier { private final OkHttpClient okHttpClient; private final Random random = new Random(System.nanoTime()); - private Queue worlds = new ArrayDeque<>(); + private final Queue worlds = new ArrayDeque<>(); @Override public World get() @@ -58,7 +60,7 @@ class WorldSupplier implements Supplier try { - List newWorlds = new WorldClient(okHttpClient) + List newWorlds = new WorldClient(okHttpClient, HttpUrl.get(RuneLiteProperties.getApiBase())) .lookupWorlds() .getWorlds() .stream() diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java index b108080454..ae25265c3f 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java @@ -336,6 +336,12 @@ public class ClientUI frame.setResizable(true); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + if (OSType.getOSType() == OSType.MacOS) + { + // Change the default quit strategy to CLOSE_ALL_WINDOWS so that ctrl+q + // triggers the listener below instead of exiting. + MacOSQuitStrategy.setup(); + } frame.addWindowListener(new WindowAdapter() { @Override @@ -550,7 +556,11 @@ public class ClientUI // When Windows screen scaling is on, the position/bounds will be wrong when they are set. // The bounds saved in shutdown are the full, non-scaled co-ordinates. - if (scale != 1) + // On MacOS the scaling is already applied and the position/bounds are correct on at least + // - 2015 x64 MBP JDK11 Mohave + // - 2020 m1 MBP JDK17 Big Sur + // Adjusting the scaling further results in the client position being incorrect + if (scale != 1 && OSType.getOSType() != OSType.MacOS) { clientBounds.setRect( clientBounds.getX() / scale, diff --git a/http-api/src/main/java/net/runelite/http/api/item/ItemType.java b/runelite-client/src/main/java/net/runelite/client/ui/MacOSQuitStrategy.java similarity index 68% rename from http-api/src/main/java/net/runelite/http/api/item/ItemType.java rename to runelite-client/src/main/java/net/runelite/client/ui/MacOSQuitStrategy.java index 9221f096b2..4c191ed3ca 100644 --- a/http-api/src/main/java/net/runelite/http/api/item/ItemType.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/MacOSQuitStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Adam + * Copyright (c) 2022, Adam * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,27 +22,27 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.item; +package net.runelite.client.ui; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.apple.eawt.Application; +import com.apple.eawt.QuitStrategy; -public enum ItemType +class MacOSQuitStrategy { - DEFAULT; - - private static final Logger logger = LoggerFactory.getLogger(ItemType.class); - - public static ItemType of(String type) + public static void setup() { try { - return ItemType.valueOf(type.toUpperCase()); + // com.apple.eawt.QuitStrategy was moved to java.desktop in Java 9, + // but our OrangeExtensions API targets 1.6, so this code is only valid + // on 8 below. + Application.getApplication() + .setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS); } - catch (IllegalArgumentException ex) + catch (NoClassDefFoundError ex) { - logger.warn("unable to convert type", ex); - return DEFAULT; + // IntelliJ doesn't handle our multi-release Maven setup well, and will run + // this class on 11+. Ignore the error so the client can launch. } } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java b/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java index 7f42fb4b29..4f3ae72c3d 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java @@ -31,7 +31,6 @@ import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; -import java.io.IOException; import java.lang.reflect.InvocationTargetException; import javax.annotation.Nullable; import javax.swing.ImageIcon; @@ -67,7 +66,7 @@ public class SplashScreen extends JFrame implements ActionListener private volatile String subActionText = ""; private volatile String progressText = null; - private SplashScreen() throws IOException + private SplashScreen() { BufferedImage logo = ImageUtil.loadImageResource(SplashScreen.class, "openosrs_transparent.png"); @@ -205,6 +204,12 @@ public class SplashScreen extends JFrame implements ActionListener } INSTANCE.timer.stop(); + // The CLOSE_ALL_WINDOWS quit strategy on MacOS dispatches WINDOW_CLOSING events to each frame + // from Window.getWindows. However, getWindows uses weak refs and relies on gc to remove windows + // from its list, causing events to get dispatched to disposed frames. The frames handle the events + // regardless of being disposed and will run the configured close operation. Set the close operation + // to DO_NOTHING_ON_CLOSE prior to disposing to prevent this. + INSTANCE.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); INSTANCE.dispose(); INSTANCE = null; }); diff --git a/runelite-client/src/main/java/net/runelite/client/ws/WSClient.java b/runelite-client/src/main/java/net/runelite/client/ws/WSClient.java index 88fc16abed..ea42605075 100644 --- a/runelite-client/src/main/java/net/runelite/client/ws/WSClient.java +++ b/runelite-client/src/main/java/net/runelite/client/ws/WSClient.java @@ -31,15 +31,17 @@ import java.util.HashSet; import java.util.Objects; import java.util.UUID; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Singleton; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import net.runelite.client.RuneLite; import net.runelite.client.eventbus.EventBus; -import net.runelite.http.api.RuneLiteAPI; import net.runelite.http.api.ws.WebsocketGsonFactory; import net.runelite.http.api.ws.WebsocketMessage; import net.runelite.http.api.ws.messages.Handshake; import net.runelite.http.api.ws.messages.party.PartyMessage; +import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @@ -52,6 +54,7 @@ public class WSClient extends WebSocketListener implements AutoCloseable { private final EventBus eventBus; private final OkHttpClient okHttpClient; + private final HttpUrl runeliteWs; private final Collection> messages = new HashSet<>(); private volatile Gson gson; @@ -60,10 +63,11 @@ public class WSClient extends WebSocketListener implements AutoCloseable private WebSocket webSocket; @Inject - private WSClient(EventBus eventBus, OkHttpClient okHttpClient) + private WSClient(EventBus eventBus, OkHttpClient okHttpClient, @Named("runelite.ws") HttpUrl runeliteWs) { this.eventBus = eventBus; this.okHttpClient = okHttpClient; + this.runeliteWs = runeliteWs; this.gson = WebsocketGsonFactory.build(WebsocketGsonFactory.factory(messages)); } @@ -101,8 +105,8 @@ public class WSClient extends WebSocketListener implements AutoCloseable } Request request = new Request.Builder() - .url(RuneLiteAPI.getWsEndpoint()) - .header("User-Agent", RuneLiteAPI.userAgent) + .url(runeliteWs) + .header("User-Agent", RuneLite.USER_AGENT) .build(); webSocket = okHttpClient.newWebSocket(request, this); diff --git a/http-api/src/main/java/net/runelite/http/api/ws/WebsocketMessage.java b/runelite-client/src/main/java11/net/runelite/client/ui/MacOSQuitStrategy.java similarity index 83% rename from http-api/src/main/java/net/runelite/http/api/ws/WebsocketMessage.java rename to runelite-client/src/main/java11/net/runelite/client/ui/MacOSQuitStrategy.java index d732c110cd..6af420ea4c 100644 --- a/http-api/src/main/java/net/runelite/http/api/ws/WebsocketMessage.java +++ b/runelite-client/src/main/java11/net/runelite/client/ui/MacOSQuitStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Adam + * Copyright (c) 2022, Adam * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,14 +22,16 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.http.api.ws; +package net.runelite.client.ui; -public class WebsocketMessage +import java.awt.Desktop; +import java.awt.desktop.QuitStrategy; + +class MacOSQuitStrategy { - protected boolean _party; - - public boolean isParty() + public static void setup() { - return _party; + Desktop.getDesktop() + .setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS); } } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc b/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc index df0cc06c5e..04433ef5a0 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc @@ -3328,5 +3328,35 @@ "z1": 0, "z2": 0 } + ], + "7513": [ // POH styles 1-4 + { + "rx1": 24, + "ry1": 0, + "rx2": 31, + "ry2": 7, + "z1": 0, + "z2": 3 + } + ], + "7769": [ // POH styles 5-8 + { + "rx1": 24, + "ry1": 0, + "rx2": 31, + "ry2": 7, + "z1": 0, + "z2": 3 + } + ], + "8025": [ // POH styles 9-12 + { + "rx1": 24, + "ry1": 0, + "rx2": 31, + "ry2": 7, + "z1": 0, + "z2": 3 + } ] } diff --git a/runelite-client/src/main/resources/net/runelite/client/runelite.properties b/runelite-client/src/main/resources/net/runelite/client/runelite.properties index 15c74da46f..4efbb62b75 100644 --- a/runelite-client/src/main/resources/net/runelite/client/runelite.properties +++ b/runelite-client/src/main/resources/net/runelite/client/runelite.properties @@ -13,4 +13,8 @@ runelite.jav_config=https://oldschool.runescape.com/jav_config.ws runelite.jav_config_backup=https://static.runelite.net/jav_config.ws runelite.pluginhub.url=https://repo.runelite.net/plugins runelite.pluginhub.version=@project.version@ -runelite.imgur.client.id=30d71e5f6860809 \ No newline at end of file +runelite.imgur.client.id=30d71e5f6860809 +runelite.api.base=https://api.runelite.net/runelite-${project.version} +runelite.session=https://api.runelite.net/session +runelite.static.base=https://static.runelite.net +runelite.ws=https://api.runelite.net/ws \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/OkHttpCacheSanityTest.java b/runelite-client/src/test/java/net/runelite/client/OkHttpTest.java similarity index 89% rename from runelite-client/src/test/java/net/runelite/client/OkHttpCacheSanityTest.java rename to runelite-client/src/test/java/net/runelite/client/OkHttpTest.java index 2478042ed2..83032c4e5c 100644 --- a/runelite-client/src/test/java/net/runelite/client/OkHttpCacheSanityTest.java +++ b/runelite-client/src/test/java/net/runelite/client/OkHttpTest.java @@ -30,7 +30,6 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Locale; import java.util.concurrent.TimeUnit; -import net.runelite.http.api.RuneLiteAPI; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @@ -38,11 +37,12 @@ import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; import org.junit.Assert; +import static org.junit.Assert.assertTrue; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -public class OkHttpCacheSanityTest +public class OkHttpTest { @Rule public TemporaryFolder cacheFolder = new TemporaryFolder(); @@ -71,9 +71,7 @@ public class OkHttpCacheSanityTest @Test public void testCacheSanity() throws IOException, InterruptedException { - OkHttpClient.Builder builder = RuneLiteAPI.CLIENT.newBuilder(); - RuneLite.setupCache(builder, cacheFolder.getRoot()); - OkHttpClient client = builder.build(); + OkHttpClient client = RuneLite.buildHttpClient(false); Instant lastModified = Instant.now().minusSeconds(20); @@ -122,4 +120,19 @@ public class OkHttpCacheSanityTest Assert.assertNotNull("cache did not make a conditional request", req); Assert.assertNotNull(req.getHeader("If-Modified-Since")); } + + @Test + public void testUserAgent() throws IOException, InterruptedException + { + server.enqueue(new MockResponse().setBody("OK")); + + Request request = new Request.Builder() + .url(server.url("/")) + .build(); + RuneLite.buildHttpClient(false) + .newCall(request).execute().close(); + + // rest of UA depends on if git is found + assertTrue(server.takeRequest().getHeader("User-Agent").startsWith("RuneLite/" + RuneLiteProperties.getVersion())); + } } diff --git a/runelite-client/src/test/java/net/runelite/client/hiscore/HiscoreClientTest.java b/runelite-client/src/test/java/net/runelite/client/hiscore/HiscoreClientTest.java index fbc2e7b48f..e0b079e6b8 100644 --- a/runelite-client/src/test/java/net/runelite/client/hiscore/HiscoreClientTest.java +++ b/runelite-client/src/test/java/net/runelite/client/hiscore/HiscoreClientTest.java @@ -25,7 +25,7 @@ package net.runelite.client.hiscore; import java.io.IOException; -import net.runelite.http.api.RuneLiteAPI; +import okhttp3.OkHttpClient; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import static org.junit.Assert.assertEquals; @@ -132,7 +132,7 @@ public class HiscoreClientTest @Test public void testNormalLookup() throws Exception { - HiscoreClient hiscoreClient = new HiscoreClient(RuneLiteAPI.CLIENT); + HiscoreClient hiscoreClient = new HiscoreClient(new OkHttpClient()); HiscoreResult result = hiscoreClient.lookup("zezima", server.url("/")); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index 8ac44d3a6a..918732d049 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -49,17 +49,18 @@ import net.runelite.api.widgets.Widget; import static net.runelite.api.widgets.WidgetID.ADVENTURE_LOG_ID; import static net.runelite.api.widgets.WidgetID.DIARY_QUEST_GROUP_ID; import net.runelite.api.widgets.WidgetInfo; +import net.runelite.client.chat.ChatClient; import net.runelite.client.chat.ChatCommandManager; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.config.ChatColorConfig; import net.runelite.client.config.ConfigManager; import net.runelite.client.config.RuneLiteConfig; +import net.runelite.client.game.ItemManager; import net.runelite.client.hiscore.HiscoreClient; import net.runelite.client.hiscore.HiscoreEndpoint; import net.runelite.client.hiscore.HiscoreResult; import net.runelite.client.hiscore.Skill; import net.runelite.http.api.RuneLiteAPI; -import net.runelite.http.api.chat.ChatClient; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; @@ -116,6 +117,10 @@ public class ChatCommandsPluginTest @Bind RuneLiteConfig runeLiteConfig; + @Mock + @Bind + ItemManager itemManager; + @Mock @Bind ChatCommandsConfig chatCommandsConfig; diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java index b6139cc265..dd46f28550 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java @@ -51,7 +51,6 @@ import net.runelite.client.input.KeyManager; import net.runelite.client.input.MouseManager; import static net.runelite.client.plugins.grandexchange.GrandExchangePlugin.findFuzzyIndices; import static net.runelite.http.api.RuneLiteAPI.GSON; -import net.runelite.http.api.ge.GrandExchangeClient; import net.runelite.http.api.ge.GrandExchangeTrade; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/loottracker/LootTrackerPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/loottracker/LootTrackerPluginTest.java index cff8a46591..4f2288a136 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/loottracker/LootTrackerPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/loottracker/LootTrackerPluginTest.java @@ -61,7 +61,6 @@ import net.runelite.client.game.SpriteManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.http.api.item.ItemPrice; import net.runelite.http.api.loottracker.LootRecordType; -import net.runelite.http.api.loottracker.LootTrackerClient; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import org.junit.Before; diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java index c9ebfba6f5..fcdc75db13 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java @@ -52,6 +52,7 @@ import net.runelite.api.events.StatChanged; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.Notifier; +import net.runelite.client.chat.ChatClient; import net.runelite.client.chat.ChatCommandManager; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.config.ConfigManager; @@ -59,7 +60,6 @@ import net.runelite.client.game.ItemManager; import net.runelite.client.game.npcoverlay.NpcOverlayService; import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import net.runelite.http.api.chat.ChatClient; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; @@ -142,6 +142,10 @@ public class SlayerPluginTest @Bind SlayerOverlay overlay; + @Mock + @Bind + TargetWeaknessOverlay targetWeaknessOverlay; + @Mock @Bind InfoBoxManager infoBoxManager; diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/specialcounter/SpecialCounterPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/specialcounter/SpecialCounterPluginTest.java index a8dce5b513..977e379a9a 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/specialcounter/SpecialCounterPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/specialcounter/SpecialCounterPluginTest.java @@ -46,6 +46,7 @@ import net.runelite.client.Notifier; import net.runelite.client.game.ItemManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ws.PartyService; +import net.runelite.client.ws.WSClient; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -81,6 +82,10 @@ public class SpecialCounterPluginTest @Bind private Notifier notifier; + @Mock + @Bind + private WSClient wsClient; + @Mock @Bind private SpecialCounterConfig specialCounterConfig;