diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 921e78f596..4f88e9d411 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -27,7 +27,7 @@ object ProjectVersions { const val launcherVersion = "2.2.0" const val rlVersion = "1.7.24" - const val openosrsVersion = "4.10.0" + const val openosrsVersion = "4.11.0" const val rsversion = 199 const val cacheversion = 165 diff --git a/cache/cache.gradle.kts b/cache/cache.gradle.kts index 9061346bcc..686be529e8 100644 --- a/cache/cache.gradle.kts +++ b/cache/cache.gradle.kts @@ -38,14 +38,14 @@ dependencies { compileOnly(group = "org.projectlombok", name = "lombok", version = ProjectVersions.lombokVersion) - implementation(group = "com.google.code.gson", name = "gson", version = "2.8.6") - implementation(group = "com.google.guava", name = "guava", version = "30.0-jre") + implementation(group = "com.google.code.gson", name = "gson", version = "2.8.5") + implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre") implementation(group = "commons-cli", name = "commons-cli", version = "1.4") implementation(group = "io.netty", name = "netty-buffer", version = "4.1.54.Final") - implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.0") + implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.1") implementation(group = "org.antlr", name = "antlr4-runtime", version = "4.8-1") - implementation(group = "org.apache.commons", name = "commons-compress", version = "1.20") - implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.30") + implementation(group = "org.apache.commons", name = "commons-compress", version = "1.21") + implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") testAnnotationProcessor(group = "org.projectlombok", name = "lombok", version = ProjectVersions.lombokVersion) diff --git a/deobfuscator/deobfuscator.gradle.kts b/deobfuscator/deobfuscator.gradle.kts index 57c0ad772a..0da4c139ef 100644 --- a/deobfuscator/deobfuscator.gradle.kts +++ b/deobfuscator/deobfuscator.gradle.kts @@ -40,15 +40,15 @@ dependencies { implementation(project(":runelite-api")) implementation(project(":runescape-api")) implementation(project(":cache")) - implementation(group = "org.jetbrains", name = "annotations", version = "20.1.0") + implementation(group = "org.jetbrains", name = "annotations", version = "22.0.0") implementation(group = "org.ow2.asm", name = "asm", version = "9.0") implementation(group = "org.ow2.asm", name = "asm-util", version = "9.0") implementation(group = "net.runelite", name = "fernflower", version = "07082019") implementation(group = "com.google.code.gson", name = "gson", version = "2.8.6") - implementation(group = "com.google.guava", name = "guava", version = "23.2-jre") - implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.12") + implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre") + implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") - runtimeOnly(group = "org.slf4j", name = "slf4j-simple", version = "1.7.12") + runtimeOnly(group = "org.slf4j", name = "slf4j-simple", version = "1.7.32") testImplementation(deobjars) testImplementation(group = "junit", name = "junit", version = "4.12") diff --git a/http-api/http-api.gradle.kts b/http-api/http-api.gradle.kts index e3ce785847..436fa78f13 100644 --- a/http-api/http-api.gradle.kts +++ b/http-api/http-api.gradle.kts @@ -34,14 +34,14 @@ dependencies { implementation(project(":runelite-api")) implementation(group = "com.google.code.gson", name = "gson", version = "2.8.5") - implementation(group = "com.google.guava", name = "guava", version = "23.2-jre") - implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "3.7.0") - implementation(group = "org.apache.commons", name = "commons-csv", version = "1.4") - implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.12") + implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre") + implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.1") + implementation(group = "org.apache.commons", name = "commons-csv", version = "1.9.0") + implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") - testImplementation(group = "com.squareup.okhttp3", name = "mockwebserver", version = "4.9.0") + testImplementation(group = "com.squareup.okhttp3", name = "mockwebserver", version = "4.9.1") testImplementation(group = "junit", name = "junit", version = "4.12") - testImplementation(group = "org.slf4j", name = "slf4j-simple", version = "1.7.12") + testImplementation(group = "org.slf4j", name = "slf4j-simple", version = "1.7.32") } tasks { diff --git a/injector/injector.gradle.kts b/injector/injector.gradle.kts index 7b2943edfb..66484a6950 100644 --- a/injector/injector.gradle.kts +++ b/injector/injector.gradle.kts @@ -24,11 +24,11 @@ dependencies { implementation(project(":runescape-client")) implementation(project(":runelite-mixins")) - implementation(group = "org.ow2.asm", name = "asm", version = "8.0.1") - implementation(group = "org.ow2.asm", name = "asm-util", version = "8.0.1") - implementation(group = "org.jetbrains", name = "annotations", version = "19.0.0") - implementation(group = "com.google.guava", name = "guava", version = "23.2-jre") - implementation(group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.1") + implementation(group = "org.ow2.asm", name = "asm", version = "9.0") + implementation(group = "org.ow2.asm", name = "asm-util", version = "9.0") + implementation(group = "org.jetbrains", name = "annotations", version = "22.0.0") + implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre") + implementation(group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.4") } tasks.register("inject") { diff --git a/injector/src/main/java/com/openosrs/injector/injection/InjectData.java b/injector/src/main/java/com/openosrs/injector/injection/InjectData.java index 378bc42d38..be301c7324 100644 --- a/injector/src/main/java/com/openosrs/injector/injection/InjectData.java +++ b/injector/src/main/java/com/openosrs/injector/injection/InjectData.java @@ -63,7 +63,7 @@ public abstract class InjectData for (final ClassFile deobClass : deobfuscated) { - if (deobClass.getName().startsWith("net/runelite/")) + if (deobClass.getName().startsWith("net/runelite/") || deobClass.getName().startsWith("netscape")) { continue; } diff --git a/runelite-api/runelite-api.gradle.kts b/runelite-api/runelite-api.gradle.kts index 615c7fe92c..56b6cd4122 100644 --- a/runelite-api/runelite-api.gradle.kts +++ b/runelite-api/runelite-api.gradle.kts @@ -31,9 +31,9 @@ dependencies { compileOnly(group = "org.projectlombok", name = "lombok", version = ProjectVersions.lombokVersion) implementation(group = "com.google.code.findbugs", name = "jsr305", version = "3.0.2") - implementation(group = "com.google.guava", name = "guava", version = "23.2-jre") - implementation(group = "org.apache.commons", name = "commons-text", version = "1.2") - implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.12") + implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre") + implementation(group = "org.apache.commons", name = "commons-text", version = "1.9") + implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") testImplementation(group = "junit", name = "junit", version = "4.12") } \ No newline at end of file diff --git a/runelite-api/src/main/java/net/runelite/api/events/ActorDeath.java b/runelite-api/src/main/java/net/runelite/api/events/ActorDeath.java index b6e4588c0c..e721be6eab 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ActorDeath.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ActorDeath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, HSJ + * Copyright (c) 2018, Matthew Steglinski * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,5 +33,5 @@ import net.runelite.api.Actor; @Value public class ActorDeath { - Actor actor; + private final Actor actor; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java b/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java index 5cbc26a97b..fe3acab950 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/AnimationChanged.java @@ -1,7 +1,31 @@ +/* + * Copyright (c) 2016-2017, Abel Briggs + * 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.api.events; -import net.runelite.api.Actor; import lombok.Data; +import net.runelite.api.Actor; /** * An event where the {@link Actor} has changed animations. diff --git a/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java b/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java index 4114cb22ca..e0f4c1fe28 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java +++ b/runelite-api/src/main/java/net/runelite/api/events/AreaSoundEffectPlayed.java @@ -33,7 +33,6 @@ public class AreaSoundEffectPlayed { @Nullable private final Actor source; - private int soundId; private int sceneX; private int sceneY; diff --git a/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java b/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java index fccf5a98d8..91ddf32ed2 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ChatMessage.java @@ -24,11 +24,11 @@ */ package net.runelite.api.events; -import net.runelite.api.ChatMessageType; -import net.runelite.api.MessageNode; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import net.runelite.api.ChatMessageType; +import net.runelite.api.MessageNode; /** * An event where a new chat message is received. diff --git a/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java b/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java index fe524a7e76..d0dfae5ff2 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java +++ b/runelite-api/src/main/java/net/runelite/api/events/CommandExecuted.java @@ -47,9 +47,9 @@ public class CommandExecuted /** * The name of the command entered. */ - String command; + private String command; /** * The command arguments that have been entered. */ - String[] arguments; + private String[] arguments; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java index a18683d7b4..661711e566 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectChanged.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.DecorativeObject; import net.runelite.api.Tile; -import lombok.Data; /** * An event where the {@link DecorativeObject} attached to a {@link Tile} diff --git a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java index 94c06488c7..77152ec9c6 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectDespawned.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.DecorativeObject; import net.runelite.api.Tile; -import lombok.Data; /** * An event where the {@link DecorativeObject} attached to a {@link Tile} diff --git a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java index fe8d17862f..b89806418e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/DecorativeObjectSpawned.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.DecorativeObject; import net.runelite.api.Tile; -import lombok.Data; /** * An event where a {@link DecorativeObject} is attached to a {@link Tile}. diff --git a/runelite-api/src/main/java/net/runelite/api/events/FakeXpDrop.java b/runelite-api/src/main/java/net/runelite/api/events/FakeXpDrop.java index 07a98b0eb4..67cbeea22d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/FakeXpDrop.java +++ b/runelite-api/src/main/java/net/runelite/api/events/FakeXpDrop.java @@ -30,6 +30,6 @@ import net.runelite.api.Skill; @Value public class FakeXpDrop { - Skill skill; - int xp; + private final Skill skill; + private final int xp; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/FriendsChatChanged.java b/runelite-api/src/main/java/net/runelite/api/events/FriendsChatChanged.java index 271eb83e49..0bab986a4d 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/FriendsChatChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/FriendsChatChanged.java @@ -35,5 +35,5 @@ public class FriendsChatChanged /** * Whether or not the client is now in a friends chat. */ - boolean joined; + private boolean joined; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/FriendsChatMemberJoined.java b/runelite-api/src/main/java/net/runelite/api/events/FriendsChatMemberJoined.java index e5a0cdb8a0..cab17bd556 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/FriendsChatMemberJoined.java +++ b/runelite-api/src/main/java/net/runelite/api/events/FriendsChatMemberJoined.java @@ -33,5 +33,5 @@ public class FriendsChatMemberJoined /** * The member that joined */ - FriendsChatMember member; + private FriendsChatMember member; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/FriendsChatMemberLeft.java b/runelite-api/src/main/java/net/runelite/api/events/FriendsChatMemberLeft.java index 0970b762c8..a5ed698988 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/FriendsChatMemberLeft.java +++ b/runelite-api/src/main/java/net/runelite/api/events/FriendsChatMemberLeft.java @@ -33,5 +33,5 @@ public class FriendsChatMemberLeft /** * The member that left */ - FriendsChatMember member; + private FriendsChatMember member; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java index 5d2e9fad1a..ed4280918a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameObjectDespawned.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.GameObject; import net.runelite.api.Tile; -import lombok.Data; /** * An event where a {@link GameObject} on a {@link Tile} is removed. diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java index dc9fdbdd24..a8b09298a5 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameObjectSpawned.java @@ -37,9 +37,9 @@ public class GameObjectSpawned /** * The affected tile. */ - Tile tile; + private Tile tile; /** * The newly spawned game object. */ - GameObject gameObject; + private GameObject gameObject; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java index 2a0b61fc40..f62ee5547e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GameStateChanged.java @@ -24,8 +24,8 @@ */ package net.runelite.api.events; -import net.runelite.api.GameState; import lombok.Data; +import net.runelite.api.GameState; /** * An event where the clients game state has changed. diff --git a/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java index 88e4aa1fac..8a7ff3ffc0 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GrandExchangeOfferChanged.java @@ -24,20 +24,21 @@ */ package net.runelite.api.events; -import net.runelite.api.GrandExchangeOffer; import lombok.Data; +import net.runelite.api.GrandExchangeOffer; +import net.runelite.api.GrandExchangeOfferState; /** - * An event where a {GrandExchangeOffer} has been updated with + * An event where a {@link GrandExchangeOffer} has been updated with * new information. *

* When the client initially logs in, this event is called for all grand - * exchange slots with the {GrandExchangeOfferState#EMPTY} state, + * exchange slots with the {@link GrandExchangeOfferState#EMPTY} state, * regardless of whether any slots have offers. Once the exchange is * initialized, the client then updates any offers with items as it * receives information from the server. *

- * See {GrandExchangeOfferState} for potential states an offer + * See {@link GrandExchangeOfferState} for potential states an offer * can change into. */ @Data diff --git a/runelite-api/src/main/java/net/runelite/api/events/GraphicChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GraphicChanged.java index 775487c6d0..9a50a5671c 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GraphicChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GraphicChanged.java @@ -1,3 +1,27 @@ +/* + * Copyright (c) 2018, 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.api.events; import lombok.Data; diff --git a/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java b/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java index 280cc77624..5af54e0660 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GraphicsObjectCreated.java @@ -24,8 +24,8 @@ */ package net.runelite.api.events; -import net.runelite.api.GraphicsObject; import lombok.Value; +import net.runelite.api.GraphicsObject; /** * An event where a new {@link GraphicsObject} has been created. @@ -36,5 +36,5 @@ public class GraphicsObjectCreated /** * The newly created graphics object. */ - GraphicsObject graphicsObject; + private final GraphicsObject graphicsObject; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java index 8fa97ae503..093948306b 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectChanged.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.GroundObject; import net.runelite.api.Tile; -import lombok.Data; /** * An event where the {@link GroundObject} on a {@link Tile} has been changed. diff --git a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java index 54bb6dfbe0..b77d1bf579 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectDespawned.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.GroundObject; import net.runelite.api.Tile; -import lombok.Data; /** * An event where a {@link GroundObject} on a {@link Tile} has been removed. diff --git a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java index af1f15ab6f..1e3d6597ff 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/GroundObjectSpawned.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.GroundObject; import net.runelite.api.Tile; -import lombok.Data; /** * An event where a {@link GroundObject} is added to a {@link Tile}. diff --git a/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java b/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java index f96a0f08d7..705667ae32 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java +++ b/runelite-api/src/main/java/net/runelite/api/events/HitsplatApplied.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.Actor; import net.runelite.api.Hitsplat; -import lombok.Data; /** * An event called when a {@link Hitsplat} is processed on an {@link Actor}. diff --git a/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java b/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java index ef1da8baca..fdfe0d1272 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/InteractingChanged.java @@ -1,7 +1,31 @@ +/* + * Copyright (c) 2018, 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.api.events; -import net.runelite.api.Actor; import lombok.Value; +import net.runelite.api.Actor; /** * An event called when the actor an actor is interacting with changes @@ -9,10 +33,10 @@ import lombok.Value; @Value public class InteractingChanged { - Actor source; + private final Actor source; /** * Target actor, may be null */ - Actor target; + private final Actor target; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java index 5a5ddef151..f2ff89a679 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemContainerChanged.java @@ -24,8 +24,8 @@ */ package net.runelite.api.events; -import net.runelite.api.ItemContainer; import lombok.Value; +import net.runelite.api.ItemContainer; /** * An event called whenever the stack size of an {@link net.runelite.api.Item} @@ -44,10 +44,10 @@ public class ItemContainerChanged /** * The modified container's ID. */ - int containerId; + private final int containerId; /** * The modified item container. */ - ItemContainer itemContainer; + private final ItemContainer itemContainer; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java index 22082bfedc..3b25a15439 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java @@ -25,9 +25,8 @@ package net.runelite.api.events; import lombok.Value; -import net.runelite.api.TileItem; import net.runelite.api.Tile; -import lombok.Value; +import net.runelite.api.TileItem; /** * Called when an item pile despawns from the ground. When the client loads a new scene, @@ -36,6 +35,6 @@ import lombok.Value; @Value public class ItemDespawned { - Tile tile; - TileItem item; + private final Tile tile; + private final TileItem item; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java b/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java index 7971da5f12..e95b2f83eb 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java @@ -25,9 +25,8 @@ package net.runelite.api.events; import lombok.Value; -import net.runelite.api.TileItem; import net.runelite.api.Tile; -import lombok.Value; +import net.runelite.api.TileItem; /** * Called when the quantity of an item pile changes. @@ -35,8 +34,8 @@ import lombok.Value; @Value public class ItemQuantityChanged { - TileItem item; - Tile tile; - int oldQuantity; - int newQuantity; + private final TileItem item; + private final Tile tile; + private final int oldQuantity; + private final int newQuantity; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java index af3c034abc..e7726fc111 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java @@ -25,9 +25,8 @@ package net.runelite.api.events; import lombok.Value; -import net.runelite.api.TileItem; import net.runelite.api.Tile; -import lombok.Value; +import net.runelite.api.TileItem; /** * Called when an item pile spawns on the ground. When the client loads a new scene, @@ -36,6 +35,6 @@ import lombok.Value; @Value public class ItemSpawned { - Tile tile; - TileItem item; + private final Tile tile; + private final TileItem item; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java b/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java index 18b106ec9f..501a1b7931 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NameableNameChanged.java @@ -24,8 +24,8 @@ */ package net.runelite.api.events; -import net.runelite.api.Nameable; import lombok.Value; +import net.runelite.api.Nameable; /** * An event where a {@link Nameable} has had their name changed. @@ -36,5 +36,5 @@ public class NameableNameChanged /** * The nameable that changed names. */ - Nameable nameable; + private final Nameable nameable; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcChanged.java b/runelite-api/src/main/java/net/runelite/api/events/NpcChanged.java index f01da68ae2..7abdb731dd 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NpcChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NpcChanged.java @@ -37,11 +37,10 @@ public class NpcChanged /** * The NPC of which the composition changed. */ - NPC npc; - + private final NPC npc; /** * The old composition of the NPC */ - NPCComposition old; -} \ No newline at end of file + private final NPCComposition old; +} diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java index 9d2fed4200..0f6399fa4a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NpcDespawned.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Value; import net.runelite.api.Actor; import net.runelite.api.NPC; -import lombok.Value; /** * An event where an {@link NPC} has despawned. @@ -37,7 +37,7 @@ public class NpcDespawned /** * The despawned NPC. */ - NPC npc; + private final NPC npc; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java index aab89fffb8..2101bdd4fb 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/NpcSpawned.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Value; import net.runelite.api.Actor; import net.runelite.api.NPC; -import lombok.Value; /** * An event where an {@link NPC} has spawned. @@ -37,7 +37,7 @@ public class NpcSpawned /** * The spawned NPC. */ - NPC npc; + private final NPC npc; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java b/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java index 9e77178776..a366eb297a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/OverheadTextChanged.java @@ -1,12 +1,39 @@ +/* + * Copyright (c) 2018, Magic fTail + * 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.api.events; -import net.runelite.api.Actor; import lombok.Value; +import net.runelite.api.Actor; +/** + * Event fired when an actors overhead text is changed. + */ @Value public class OverheadTextChanged { - Actor actor; + private final Actor actor; - String overheadText; + private final String overheadText; } \ No newline at end of file diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java index ed5f2a9057..9e38311069 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PlayerDespawned.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Value; import net.runelite.api.Actor; import net.runelite.api.Player; -import lombok.Value; /** * An event where a {@link Player} has despawned. @@ -39,7 +39,7 @@ public class PlayerDespawned /** * The despawned player. */ - Player player; + private final Player player; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java index 73e1932285..f730a0b652 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PlayerSpawned.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Value; import net.runelite.api.Actor; import net.runelite.api.Player; -import lombok.Value; /** * An event where a {@link Player} has spawned. @@ -37,7 +37,7 @@ public class PlayerSpawned /** * The spawned player. */ - Player player; + private final Player player; public Actor getActor() { diff --git a/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java b/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java index c8896ff945..01085f05bb 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java +++ b/runelite-api/src/main/java/net/runelite/api/events/PostHealthBar.java @@ -24,8 +24,8 @@ */ package net.runelite.api.events; -import net.runelite.api.HealthBar; import lombok.Data; +import net.runelite.api.HealthBar; @Data public class PostHealthBar diff --git a/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java b/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java index 70d73d7026..6d9a1c281f 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ProjectileMoved.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.Projectile; import net.runelite.api.coords.LocalPoint; -import lombok.Data; /** * An event called whenever a {@link Projectile} has moved towards a point. diff --git a/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java b/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java index 3d109ef982..a4bed3e95f 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java +++ b/runelite-api/src/main/java/net/runelite/api/events/RemovedFriend.java @@ -37,4 +37,4 @@ public class RemovedFriend * The removed friend or ignore entry */ private final Nameable nameable; -} \ No newline at end of file +} diff --git a/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java b/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java index 716f7bbe90..d13b03ea8a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java @@ -24,8 +24,8 @@ */ package net.runelite.api.events; -import net.runelite.api.Script; import lombok.Data; +import net.runelite.api.Script; /** * A callback from a runelite_callback opcode in a cs2 diff --git a/runelite-api/src/main/java/net/runelite/api/events/ScriptPostFired.java b/runelite-api/src/main/java/net/runelite/api/events/ScriptPostFired.java index 55338bd87a..1337dcead1 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ScriptPostFired.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ScriptPostFired.java @@ -35,5 +35,5 @@ public class ScriptPostFired /** * The script id of the invoked script */ - int scriptId; + private final int scriptId; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/ScriptPreFired.java b/runelite-api/src/main/java/net/runelite/api/events/ScriptPreFired.java index f8e9549281..c509303784 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ScriptPreFired.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ScriptPreFired.java @@ -24,22 +24,22 @@ */ package net.runelite.api.events; -import lombok.Value; +import lombok.Data; import net.runelite.api.ScriptEvent; /** * An event that is fired before the designated script is ran */ -@Value +@Data public class ScriptPreFired { /** * The script id of the invoked script */ - int scriptId; + private final int scriptId; /** * The input of the script invoke, this will be null unless it is the root script */ - ScriptEvent scriptEvent; + private ScriptEvent scriptEvent; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java b/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java index 7c111d1d8d..06002f717a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java +++ b/runelite-api/src/main/java/net/runelite/api/events/SoundEffectPlayed.java @@ -33,10 +33,8 @@ public class SoundEffectPlayed { @Nullable private final Actor source; - private int soundId; private int delay; - private int npcid; private boolean consumed; diff --git a/runelite-api/src/main/java/net/runelite/api/events/StatChanged.java b/runelite-api/src/main/java/net/runelite/api/events/StatChanged.java index 809636f446..b5fd373731 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/StatChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/StatChanged.java @@ -33,8 +33,8 @@ import net.runelite.api.Skill; @Value public class StatChanged { - Skill skill; - int xp; - int level; - int boostedLevel; + private final Skill skill; + private final int xp; + private final int level; + private final int boostedLevel; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java index 521e8a62ae..911befbf27 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java @@ -28,11 +28,10 @@ package net.runelite.api.events; import lombok.Value; /** - * An event where a client int var has changed. * @see net.runelite.api.VarClientInt */ @Value public class VarClientIntChanged { - int index; + private int index; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java index 2fff4da47e..5a68f5f3f9 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java @@ -28,11 +28,10 @@ package net.runelite.api.events; import lombok.Value; /** - * An event where a client var string has changed. * @see net.runelite.api.VarClientStr */ @Value public class VarClientStrChanged { - int index; + private int index; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java index 30e87b9c79..8af4ee481b 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VolumeChanged.java @@ -37,5 +37,5 @@ public class VolumeChanged AREA } - Type type; -} \ No newline at end of file + private final Type type; +} diff --git a/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java b/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java index bea7686602..9d20cf3b11 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WallObjectChanged.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.Tile; import net.runelite.api.WallObject; -import lombok.Data; /** * An event where the {@link WallObject} of a {@link Tile} has been changed. diff --git a/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java b/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java index 6ac609a46f..b6a6a69b96 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WallObjectDespawned.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.Tile; import net.runelite.api.WallObject; -import lombok.Data; /** * An event where a {@link WallObject} on a {@link Tile} has been removed. diff --git a/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java b/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java index dc22e07f7d..0a2feaa1d3 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WallObjectSpawned.java @@ -24,9 +24,9 @@ */ package net.runelite.api.events; +import lombok.Data; import net.runelite.api.Tile; import net.runelite.api.WallObject; -import lombok.Data; /** * An event where a {@link WallObject} is added to a {@link Tile}. diff --git a/runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java b/runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java index 3b641e27e6..408114af1e 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java @@ -36,4 +36,4 @@ import net.runelite.api.Client; */ public class WorldChanged { -} \ No newline at end of file +} diff --git a/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java b/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java index c45f4cf1ae..f7cc8e243f 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WorldListLoad.java @@ -1,37 +1,37 @@ -/* - * Copyright (c) 2018, 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.api.events; - -import net.runelite.api.World; -import lombok.Value; - -/** - * Event when the world list is loaded for the world switcher - */ -@Value -public class WorldListLoad -{ - World[] worlds; -} +/* + * Copyright (c) 2018, 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.api.events; + +import lombok.Value; +import net.runelite.api.World; + +/** + * Event when the world list is loaded for the world switcher + */ +@Value +public class WorldListLoad +{ + private final World[] worlds; +} diff --git a/runelite-client/runelite-client.gradle.kts b/runelite-client/runelite-client.gradle.kts index e49a905f86..529319f29f 100644 --- a/runelite-client/runelite-client.gradle.kts +++ b/runelite-client/runelite-client.gradle.kts @@ -44,7 +44,7 @@ description = "RuneLite Client" dependencies { annotationProcessor(group = "org.projectlombok", name = "lombok", version = ProjectVersions.lombokVersion) - annotationProcessor(group = "org.pf4j", name = "pf4j", version = "3.5.0") + annotationProcessor(group = "org.pf4j", name = "pf4j", version = "3.6.0") api(project(":runelite-api")) @@ -56,23 +56,24 @@ dependencies { implementation(project(":runelite-jshell")) implementation(group = "ch.qos.logback", name = "logback-classic", version = "1.2.3") implementation(group = "com.google.code.gson", name = "gson", version = "2.8.5") - implementation(group = "com.google.guava", name = "guava", version = "23.2-jre") - implementation(group = "com.google.inject", name = "guice", version = "4.1.0", classifier = "no_aop") + implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre") + implementation(group = "com.google.inject", name = "guice", version = "5.0.1") implementation(group = "com.h2database", name = "h2", version = "1.4.200") - implementation(group = "com.jakewharton.rxrelay3", name = "rxrelay", version = "3.0.0") - implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "3.7.0") - implementation(group = "io.reactivex.rxjava3", name = "rxjava", version = "3.0.10") + implementation(group = "com.jakewharton.rxrelay3", name = "rxrelay", version = "3.0.1") + implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.1") + implementation(group = "io.reactivex.rxjava3", name = "rxjava", version = "3.1.1") + implementation(group = "org.jgroups", name = "jgroups", version = "5.1.9.Final") implementation(group = "net.java.dev.jna", name = "jna", version = "5.9.0") - implementation(group = "org.jgroups", name = "jgroups", version = "5.0.4.Final") implementation(group = "net.java.dev.jna", name = "jna-platform", version = "5.9.0") implementation(group = "net.runelite", name = "discord", version = "1.4") - implementation(group = "net.runelite.pushingpixels", name = "substance", version = "8.0.02") - implementation(group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.1") - implementation(group = "org.apache.commons", name = "commons-text", version = "1.2") + implementation(group = "org.pushing-pixels", name = "radiance-substance", version = "4.0.0") + implementation(group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.4") + implementation(group = "org.madlonkay", name = "desktopsupport", version = "0.6.0") + implementation(group = "org.apache.commons", name = "commons-text", version = "1.9") implementation(group = "commons-io", name = "commons-io", version = "2.8.0") - implementation(group = "org.jetbrains", name = "annotations", version = "20.1.0") + implementation(group = "org.jetbrains", name = "annotations", version = "22.0.0") implementation(group = "com.github.zafarkhaja", name = "java-semver", version = "0.9.0") - implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.12") + implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") implementation(group = "org.pf4j", name = "pf4j", version = "3.6.0") { exclude(group = "org.slf4j") } @@ -105,8 +106,8 @@ dependencies { testImplementation(group = "junit", name = "junit", version = "4.12") testImplementation(group = "org.mockito", name = "mockito-core", version = "3.1.0") testImplementation(group = "org.mockito", name = "mockito-inline", version = "3.1.0") - testImplementation(group = "com.squareup.okhttp3", name = "mockwebserver", version = "3.7.0") - testImplementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.12") + testImplementation(group = "com.squareup.okhttp3", name = "mockwebserver", version = "4.9.1") + testImplementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") } fun formatDate(date: Date?) = with(date ?: Date()) { diff --git a/runelite-client/src/main/java/com/openosrs/client/graphics/ModelOutlineRenderer.java b/runelite-client/src/main/java/com/openosrs/client/graphics/ModelOutlineRenderer.java deleted file mode 100644 index 6e366ef7ad..0000000000 --- a/runelite-client/src/main/java/com/openosrs/client/graphics/ModelOutlineRenderer.java +++ /dev/null @@ -1,1138 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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 com.openosrs.client.graphics; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.awt.image.DataBufferInt; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import lombok.RequiredArgsConstructor; -import lombok.Value; -import net.runelite.api.Client; -import net.runelite.api.DecorativeObject; -import net.runelite.api.GameObject; -import net.runelite.api.GroundObject; -import net.runelite.api.ItemLayer; -import net.runelite.api.MainBufferProvider; -import net.runelite.api.Model; -import net.runelite.api.NPC; -import net.runelite.api.NPCComposition; -import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.Renderable; -import net.runelite.api.TileObject; -import net.runelite.api.WallObject; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.task.Schedule; -import net.runelite.client.task.Scheduler; - -@Deprecated(forRemoval = true, since = "4.9.2") -@Singleton -public class ModelOutlineRenderer -{ - /* - * This class doesn't really "need" static variables, but they are - * static for performance reasons. Arrays are kept outside methods - * to avoid frequent big allocations. Arrays should mostly be seen - * as ArrayLists. The size of them is increased whenever they need - * to become bigger. - */ - - private final Client client; - - private boolean isReset; - private boolean usedSinceLastCheck; - - // Dimensions of the underlying image - private int imageWidth; - private int imageHeight; - - // Boundaries for the current rasterization - private int clipX1; - private int clipY1; - private int clipX2; - private int clipY2; - - // Pixel points that would be rendered to - private int[] visited; - private int currentVisitedNumber = 0; - - // Transformed vertex positions - private int[] projectedVerticesX; - private int[] projectedVerticesY; - private boolean[] projectedVerticesRenderable; - - // An array of pixel points to raster onto the image. These are checked against - // clip boundaries and the visited array to prevent drawing on top of the model - // and outside the scene area. They are grouped per distance to the closest pixel - // drawn on the model. - private int[][] outlinePixels; - private int[] outlinePixelsLengths; // outlinePixelsLength[i] is the used length of outlinePixels[i] - private int outlineArrayWidth; - - // A list of pixel distances ordered from shortest to longest distance for - // each outline width. These are calculated once upon first usage and then - // stored here to prevent reevaluation. - private List> precomputedDistancePriorities; - - @Inject - private ModelOutlineRenderer(Client client, Scheduler scheduler) - { - this.client = client; - scheduler.registerObject(this); - - reset(); - } - - @Schedule(period = 5, unit = ChronoUnit.SECONDS) - public void checkUsage() - { - if (!isReset && !usedSinceLastCheck) - { - // Reset memory allocated when the rasterizer becomes inactive - reset(); - } - usedSinceLastCheck = false; - } - - /** - * Reset memory used by the rasterizer - */ - private void reset() - { - visited = new int[0]; - projectedVerticesX = new int[0]; - projectedVerticesY = new int[0]; - projectedVerticesRenderable = new boolean[0]; - outlinePixels = new int[0][]; - outlinePixelsLengths = new int[0]; - precomputedDistancePriorities = new ArrayList<>(0); - isReset = true; - } - - /** - * Calculate the next power of two of a value - * - * @param value The value to find the next power of two of - * @return Returns the next power of two - */ - private static int nextPowerOfTwo(int value) - { - value--; - value |= value >> 1; - value |= value >> 2; - value |= value >> 4; - value |= value >> 8; - value |= value >> 16; - value++; - return value; - } - - /** - * Determine if a triangle goes counter clockwise - * - * @return Returns true if the triangle goes counter clockwise and should be culled, otherwise false - */ - private static boolean cullFace(int x1, int y1, int x2, int y2, int x3, int y3) - { - return - (y2 - y1) * (x3 - x2) - - (x2 - x1) * (y3 - y2) < 0; - } - - /** - * Gets the list of pixel distances ordered by distance from closest pixel for a specific outline width. - * - * @param outlineWidth The outline width - * @return Returns the list of pixel distances - */ - private List getPriorityList(int outlineWidth) - { - while (precomputedDistancePriorities.size() <= outlineWidth) - { - precomputedDistancePriorities.add(null); - } - - // Grab the cached outline width if we have one - if (precomputedDistancePriorities.get(outlineWidth) != null) - { - return precomputedDistancePriorities.get(outlineWidth); - } - - List ps = new ArrayList<>(); - for (int x = 0; x <= outlineWidth; x++) - { - for (int y = 0; y <= outlineWidth; y++) - { - if (x == 0 && y == 0) - { - continue; - } - - double dist = Math.sqrt(x * x + y * y); - if (dist > outlineWidth) - { - continue; - } - - int outerAlpha = outlineWidth == 1 ? 255 // For preventing division by 0 - : (int) (255 * (dist - 1) / (outlineWidth - 1)); - ps.add(new PixelDistanceAlpha(outerAlpha, x + y * outlineArrayWidth)); - } - } - ps.sort(Comparator.comparingDouble(PixelDistanceAlpha::getOuterAlpha)); - precomputedDistancePriorities.set(outlineWidth, ps); - - return ps; - } - - /** - * Checks that the size of outlinePixels is big enough to hold a specific - * amount of elements. This is used to reduce the amount of if checks needed - * when adding elements to outlinePixels. - * - * @param distArrayPos The position in the array - * @param additionalMinimumSize The additional minimum size required - */ - private void ensureMinimumOutlineQueueSize(int distArrayPos, int additionalMinimumSize) - { - int minimumSize = outlinePixelsLengths[distArrayPos] + additionalMinimumSize; - while (outlinePixels[distArrayPos].length < minimumSize) - { - int[] newArr = new int[nextPowerOfTwo(minimumSize)]; - System.arraycopy(outlinePixels[distArrayPos], 0, newArr, 0, - outlinePixels[distArrayPos].length); - outlinePixels[distArrayPos] = newArr; - } - } - - /** - * Resets the visited flag for a specific amount of pixels - * - * @param pixelAmount The amount of pixels to reset - */ - private void resetVisited(int pixelAmount) - { - // The visited array is essentially a boolean array, but by - // making it an int array and checking if visited[i] == currentVisitedNumber - // and changing currentVisitedNumber for every new outline, we can essentially - // reset the whole array without having to iterate over every element - - if (visited.length < pixelAmount) - { - visited = new int[nextPowerOfTwo(pixelAmount)]; - currentVisitedNumber = 0; - } - - currentVisitedNumber++; - } - - /** - * Resets the pixels that are queued for outlining - * - * @param outlineWidth The width of the outline to reset pixels for - */ - private void resetOutline(int outlineWidth) - { - outlineArrayWidth = outlineWidth + 2; - - int arraySizes = outlineArrayWidth * outlineArrayWidth; - if (outlinePixels.length < arraySizes) - { - outlinePixels = new int[arraySizes][]; - outlinePixelsLengths = new int[arraySizes]; - for (int i = 0; i < arraySizes; i++) - { - outlinePixels[i] = new int[4]; - } - } - else - { - for (int i = 0; i < arraySizes; i++) - { - outlinePixelsLengths[i] = 0; - } - } - } - - /** - * Simulates a horizontal line rasterization and adds the pixels to the left - * and to the right to the outline queue if they are within the clip area. - * - * @param pixelPos The pixel position in the line where x == 0 - * @param x1 The starting x position - * @param x2 The ending x position - */ - private void simulateHorizontalLineRasterizationForOutline(int pixelPos, int x1, int x2) - { - if (x2 > clipX2) - { - x2 = clipX2; - } - if (x1 < clipX1) - { - x1 = clipX1; - } - if (x1 >= x2) - { - return; - } - - // Queue the pixel positions to the left and to the right of the line - ensureMinimumOutlineQueueSize(1, 2); - if (x2 < clipX2) - { - outlinePixels[1][outlinePixelsLengths[1]++] = pixelPos + x2; - } - if (x1 > clipX1) - { - outlinePixels[1][outlinePixelsLengths[1]++] = pixelPos + x1 - 1; - } - - // Divide by 4 to account for loop unrolling - int xDist = x2 - x1 >> 2; - pixelPos += x1; - - // This loop could run over 100m times per second without loop unrolling in some cases, - // so unrolling it can give a noticeable performance boost. - while (xDist-- > 0) - { - visited[pixelPos++] = currentVisitedNumber; - visited[pixelPos++] = currentVisitedNumber; - visited[pixelPos++] = currentVisitedNumber; - visited[pixelPos++] = currentVisitedNumber; - } - - // Draw up to 3 more pixels if there were any left - xDist = (x2 - x1) & 3; - while (xDist-- > 0) - { - visited[pixelPos++] = currentVisitedNumber; - } - } - - /** - * Queues the pixel positions above and below two horizontal lines, excluding those - * where the x positions of the lines intersect. - * - * @param pixelPos The pixel position at x == 0 of the second line - * @param x1 The starting x position of the first line - * @param x2 The ending x position of the first line - * @param x3 The starting x position of the second line - * @param x4 The ending x position of the second line - */ - private void outlineAroundHorizontalLine(int pixelPos, int x1, int x2, int x3, int x4) - { - if (x1 < clipX1) - { - x1 = clipX1; - } - if (x2 < clipX1) - { - x2 = clipX1; - } - if (x3 < clipX1) - { - x3 = clipX1; - } - if (x4 < clipX1) - { - x4 = clipX1; - } - - if (x1 > clipX2) - { - x1 = clipX2; - } - if (x2 > clipX2) - { - x2 = clipX2; - } - if (x3 > clipX2) - { - x3 = clipX2; - } - if (x4 > clipX2) - { - x4 = clipX2; - } - - if (x1 < x3) - { - ensureMinimumOutlineQueueSize(outlineArrayWidth, x3 - x1); - for (int x = x1; x < x3; x++) - { - outlinePixels[outlineArrayWidth][outlinePixelsLengths[outlineArrayWidth]++] = pixelPos - imageWidth + x; - } - } - else - { - ensureMinimumOutlineQueueSize(outlineArrayWidth, x1 - x3); - for (int x = x3; x < x1; x++) - { - outlinePixels[outlineArrayWidth][outlinePixelsLengths[outlineArrayWidth]++] = pixelPos + x; - } - } - - if (x2 < x4) - { - ensureMinimumOutlineQueueSize(outlineArrayWidth, x4 - x2); - for (int x = x2; x < x4; x++) - { - outlinePixels[outlineArrayWidth][outlinePixelsLengths[outlineArrayWidth]++] = pixelPos + x; - } - } - else - { - ensureMinimumOutlineQueueSize(outlineArrayWidth, x2 - x4); - for (int x = x4; x < x2; x++) - { - outlinePixels[outlineArrayWidth][outlinePixelsLengths[outlineArrayWidth]++] = pixelPos - imageWidth + x; - } - } - } - - /** - * Simulates rasterization of a triangle and adds every pixel outside the triangle - * to the outline queue. - * - * @param x1 The x position of the first vertex in the triangle - * @param y1 The y position of the first vertex in the triangle - * @param x2 The x position of the second vertex in the triangle - * @param y2 The y position of the second vertex in the triangle - * @param x3 The x position of the third vertex in the triangle - * @param y3 The y position of the third vertex in the triangle - */ - private void simulateTriangleRasterizationForOutline(int x1, int y1, int x2, int y2, int x3, int y3) - { - // Swap vertices so y1 <= y2 <= y3 using bubble sort - if (y1 > y2) - { - int yp = y1; - int xp = x1; - y1 = y2; - y2 = yp; - x1 = x2; - x2 = xp; - } - if (y2 > y3) - { - int yp = y2; - int xp = x2; - y2 = y3; - y3 = yp; - x2 = x3; - x3 = xp; - } - if (y1 > y2) - { - int yp = y1; - int xp = x1; - y1 = y2; - y2 = yp; - x1 = x2; - x2 = xp; - } - - if (y1 > clipY2) - { - // All points are outside clip boundaries - return; - } - - int slope1 = 0; - if (y1 != y2) - { - slope1 = (x2 - x1 << 14) / (y2 - y1); - } - - int slope2 = 0; - if (y3 != y2) - { - slope2 = (x3 - x2 << 14) / (y3 - y2); - } - - int slope3 = 0; - if (y1 != y3) - { - slope3 = (x1 - x3 << 14) / (y1 - y3); - } - - if (y2 > clipY2) - { - y2 = clipY2; - } - if (y3 > clipY2) - { - y3 = clipY2; - } - if (y1 == y3 || y3 < 0) - { - return; - } - - x1 <<= 14; - x2 <<= 14; - x3 = x1; - - if (y1 < 0) - { - x3 -= y1 * slope3; - x1 -= y1 * slope1; - y1 = 0; - } - if (y2 < 0) - { - x2 -= slope2 * y2; - y2 = 0; - } - - int pixelPos = y1 * imageWidth; - int currX1; - int currX2; - if (y1 != y2 && slope3 < slope1 || y1 == y2 && slope3 > slope2) - { - int height1 = y2 - y1; - int height2 = y3 - y2; - - int prevX1; - int prevX2; - if (height1 <= 0) - { - prevX1 = x3 >> 14; - prevX2 = x2 >> 14; - } - else - { - prevX1 = x3 >> 14; - prevX2 = x1 >> 14; - } - - outlineAroundHorizontalLine(pixelPos, prevX1, prevX2, prevX2, prevX2); - - while (height1-- > 0) - { - currX1 = x3 >> 14; - currX2 = x1 >> 14; - outlineAroundHorizontalLine(pixelPos, currX1, currX2, prevX1, prevX2); - simulateHorizontalLineRasterizationForOutline(pixelPos, currX1, currX2); - x3 += slope3; - x1 += slope1; - pixelPos += imageWidth; - prevX1 = currX1; - prevX2 = currX2; - } - - while (height2-- > 0) - { - currX1 = x3 >> 14; - currX2 = x2 >> 14; - outlineAroundHorizontalLine(pixelPos, currX1, currX2, prevX1, prevX2); - simulateHorizontalLineRasterizationForOutline(pixelPos, currX1, currX2); - x3 += slope3; - x2 += slope2; - pixelPos += imageWidth; - prevX1 = currX1; - prevX2 = currX2; - } - - outlineAroundHorizontalLine(pixelPos, prevX1, prevX1, prevX1, prevX2); - } - else - { - int height1 = y2 - y1; - int height2 = y3 - y2; - - int prevX1; - int prevX2; - if (height1 <= 0) - { - prevX1 = x2 >> 14; - prevX2 = x3 >> 14; - } - else - { - prevX1 = x1 >> 14; - prevX2 = x3 >> 14; - } - - outlineAroundHorizontalLine(pixelPos, prevX1, prevX2, prevX2, prevX2); - - while (height1-- > 0) - { - currX1 = x1 >> 14; - currX2 = x3 >> 14; - outlineAroundHorizontalLine(pixelPos, currX1, currX2, prevX1, prevX2); - simulateHorizontalLineRasterizationForOutline(pixelPos, currX1, currX2); - x1 += slope1; - x3 += slope3; - pixelPos += imageWidth; - prevX1 = currX1; - prevX2 = currX2; - } - - while (height2-- > 0) - { - currX1 = x2 >> 14; - currX2 = x3 >> 14; - outlineAroundHorizontalLine(pixelPos, currX1, currX2, prevX1, prevX2); - simulateHorizontalLineRasterizationForOutline(pixelPos, currX1, currX2); - x3 += slope3; - x2 += slope2; - pixelPos += imageWidth; - prevX1 = currX1; - prevX2 = currX2; - } - - outlineAroundHorizontalLine(pixelPos, prevX1, prevX1, prevX1, prevX2); - } - } - - /** - * Translates the vertices 3D points to the screen canvas 2D points - * - * @param localX The local x position of the vertices - * @param localY The local y position of the vertices - * @param localZ The local z position of the vertices - * @param vertexOrientation The orientation of the vertices - * @return Returns true if any of them are inside the clip area, otherwise false - */ - private boolean projectVertices(Model model, final int localX, final int localY, final int localZ, final int vertexOrientation) - { - final int cameraX = client.getCameraX(); - final int cameraY = client.getCameraY(); - final int cameraZ = client.getCameraZ(); - final int cameraYaw = client.getCameraYaw(); - final int cameraPitch = client.getCameraPitch(); - final int scale = client.getScale(); - final int orientationSin = Perspective.SINE[vertexOrientation]; - final int orientationCos = Perspective.COSINE[vertexOrientation]; - final int pitchSin = Perspective.SINE[cameraPitch]; - final int pitchCos = Perspective.COSINE[cameraPitch]; - final int yawSin = Perspective.SINE[cameraYaw]; - final int yawCos = Perspective.COSINE[cameraYaw]; - final int vertexCount = model.getVerticesCount(); - final int[] verticesX = model.getVerticesX(); - final int[] verticesY = model.getVerticesY(); - final int[] verticesZ = model.getVerticesZ(); - - boolean anyVisible = false; - - // Make sure the arrays are big enough - while (projectedVerticesX.length < vertexCount) - { - int newSize = nextPowerOfTwo(vertexCount); - projectedVerticesX = new int[newSize]; - projectedVerticesY = new int[newSize]; - projectedVerticesRenderable = new boolean[newSize]; - } - - for (int i = 0; i < vertexCount; i++) - { - int vx = verticesX[i]; - int vy = verticesZ[i]; - int vz = verticesY[i]; - int vh; // Value holder - - // Rotate based on orientation - vh = vx * orientationCos + vy * orientationSin >> 16; - vy = vy * orientationCos - vx * orientationSin >> 16; - vx = vh; - - // Translate to local coords - vx += localX; - vy += localY; - vz += localZ; - - // Translate to camera - vx -= cameraX; - vy -= cameraY; - vz -= cameraZ; - - // Transform to canvas - vh = vx * yawCos + vy * yawSin >> 16; - vy = vy * yawCos - vx * yawSin >> 16; - vx = vh; - vh = vz * pitchCos - vy * pitchSin >> 16; - vz = vz * pitchSin + vy * pitchCos >> 16; - vy = vh; - - if (vz >= 50) - { - projectedVerticesX[i] = (clipX1 + clipX2) / 2 + vx * scale / vz; - projectedVerticesY[i] = (clipY1 + clipY2) / 2 + vy * scale / vz; - - projectedVerticesRenderable[i] = true; - anyVisible |= - projectedVerticesX[i] >= clipX1 && projectedVerticesX[i] < clipX2 && - projectedVerticesY[i] >= clipY1 && projectedVerticesY[i] < clipY2; - } - else - { - projectedVerticesRenderable[i] = false; - } - } - - return anyVisible; - } - - /** - * Simulate rendering of the model and puts every pixel of the wireframe of - * the non-culled and non-transparent faces into the outline pixel queue. - */ - private void simulateModelRasterizationForOutline(Model model) - { - final int triangleCount = model.getTrianglesCount(); - final int[] indices1 = model.getTrianglesX(); - final int[] indices2 = model.getTrianglesY(); - final int[] indices3 = model.getTrianglesZ(); - final byte[] triangleTransparencies = model.getTriangleTransparencies(); - - for (int i = 0; i < triangleCount; i++) - { - if (projectedVerticesRenderable[indices1[i]] && - projectedVerticesRenderable[indices2[i]] && - projectedVerticesRenderable[indices3[i]] && - // 254 and 255 counts as fully transparent - (triangleTransparencies == null || (triangleTransparencies[i] & 255) < 254)) - { - final int index1 = indices1[i]; - final int index2 = indices2[i]; - final int index3 = indices3[i]; - final int v1x = projectedVerticesX[index1]; - final int v1y = projectedVerticesY[index1]; - final int v2x = projectedVerticesX[index2]; - final int v2y = projectedVerticesY[index2]; - final int v3x = projectedVerticesX[index3]; - final int v3y = projectedVerticesY[index3]; - - if (!cullFace(v1x, v1y, v2x, v2y, v3x, v3y)) - { - simulateTriangleRasterizationForOutline( - v1x, v1y, v2x, v2y, v3x, v3y); - } - } - } - } - - /** - * Draws an outline of the pixels in the outline queue to an image - * - * @param image The image to draw the outline to - * @param outlineWidth The width of the outline - * @param innerColor The color of the pixels of the outline closest to the model - * @param outerColor The color of the pixels of the outline furthest away from the model - */ - private void renderOutline(BufferedImage image, int outlineWidth, Color innerColor, Color outerColor) - { - int[] imageData = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); - List ps = getPriorityList(outlineWidth); - - for (PixelDistanceAlpha p : ps) - { - int color; - int alpha; - if (outlineWidth == 1) - { - color = - ((innerColor.getRed() + outerColor.getRed()) << 15) | - ((innerColor.getGreen() + outerColor.getGreen() << 7)) | - ((innerColor.getBlue() + outerColor.getBlue() >> 1)); - alpha = (innerColor.getAlpha() + outerColor.getAlpha()) >> 1; - } - else - { - int outerAlpha = p.getOuterAlpha(); - int innerAlpha = 255 - outerAlpha; - int innerAlphaFraction = (innerAlpha * innerColor.getAlpha()) / 255; - int outerAlphaFraction = (outerAlpha * outerColor.getAlpha()) / 255; - alpha = innerAlphaFraction + outerAlphaFraction; - if (alpha != 0) - { - color = - ((innerColor.getRed() * innerAlphaFraction + - outerColor.getRed() * outerAlphaFraction) / alpha << 16) | - ((innerColor.getGreen() * innerAlphaFraction + - outerColor.getGreen() * outerAlphaFraction) / alpha << 8) | - ((innerColor.getBlue() * innerAlphaFraction + - outerColor.getBlue() * outerAlphaFraction) / alpha); - } - else - { - color = 0; - } - } - - final int distArrayPos = p.getDistArrayPos(); - final int nextDistArrayPosY = distArrayPos + outlineArrayWidth; - final int nextDistArrayPosX = distArrayPos + 1; - ensureMinimumOutlineQueueSize(nextDistArrayPosX, outlinePixelsLengths[distArrayPos] * 2); - ensureMinimumOutlineQueueSize(nextDistArrayPosY, outlinePixelsLengths[distArrayPos] * 2); - - // The following 3 branches do the same thing, but when the requirements are simple, - // there are less checks needed which can give a performance boost. - if (alpha == 255) - { - if (outlineWidth == 1) - { - for (int i2 = 0; i2 < outlinePixelsLengths[distArrayPos]; i2++) - { - int pixelPos = outlinePixels[distArrayPos][i2]; - int x = pixelPos % imageWidth; - int y = pixelPos / imageWidth; - if (x < clipX1 || x >= clipX2 || - y < clipY1 || y >= clipY2 || - visited[pixelPos] == currentVisitedNumber) - { - continue; - } - - imageData[pixelPos] = color; - } - } - else - { - for (int i2 = 0; i2 < outlinePixelsLengths[distArrayPos]; i2++) - { - int pixelPos = outlinePixels[distArrayPos][i2]; - int x = pixelPos % imageWidth; - int y = pixelPos / imageWidth; - if (x < clipX1 || x >= clipX2 || - y < clipY1 || y >= clipY2 || - visited[pixelPos] == currentVisitedNumber) - { - continue; - } - visited[pixelPos] = currentVisitedNumber; - - imageData[pixelPos] = color; - - if (pixelPos % imageWidth != 0) - { - outlinePixels[nextDistArrayPosX][outlinePixelsLengths[nextDistArrayPosX]++] = pixelPos - 1; - } - if ((pixelPos + 1) % imageWidth != 0) - { - outlinePixels[nextDistArrayPosX][outlinePixelsLengths[nextDistArrayPosX]++] = pixelPos + 1; - } - outlinePixels[nextDistArrayPosY][outlinePixelsLengths[nextDistArrayPosY]++] = pixelPos - imageWidth; - outlinePixels[nextDistArrayPosY][outlinePixelsLengths[nextDistArrayPosY]++] = pixelPos + imageWidth; - } - } - } - else - { - for (int i2 = 0; i2 < outlinePixelsLengths[distArrayPos]; i2++) - { - int pixelPos = outlinePixels[distArrayPos][i2]; - int x = pixelPos % imageWidth; - int y = pixelPos / imageWidth; - if (x < clipX1 || x >= clipX2 || - y < clipY1 || y >= clipY2 || - visited[pixelPos] == currentVisitedNumber) - { - continue; - } - visited[pixelPos] = currentVisitedNumber; - - imageData[pixelPos] = - ((((color & 0xFF0000) * alpha + (imageData[pixelPos] & 0xFF0000) * (255 - alpha)) / 255) & 0xFF0000) + - ((((color & 0xFF00) * alpha + (imageData[pixelPos] & 0xFF00) * (255 - alpha)) / 255) & 0xFF00) + - ((((color & 0xFF) * alpha + (imageData[pixelPos] & 0xFF) * (255 - alpha)) / 255) & 0xFF); - - if (pixelPos % imageWidth != 0) - { - outlinePixels[nextDistArrayPosX][outlinePixelsLengths[nextDistArrayPosX]++] = pixelPos - 1; - } - if ((pixelPos + 1) % imageWidth != 0) - { - outlinePixels[nextDistArrayPosX][outlinePixelsLengths[nextDistArrayPosX]++] = pixelPos + 1; - } - outlinePixels[nextDistArrayPosY][outlinePixelsLengths[nextDistArrayPosY]++] = pixelPos - imageWidth; - outlinePixels[nextDistArrayPosY][outlinePixelsLengths[nextDistArrayPosY]++] = pixelPos + imageWidth; - } - } - } - } - - /** - * Draws an outline around a model to an image - * - * @param localX The local x position of the model - * @param localY The local y position of the model - * @param localZ The local z position of the model - * @param orientation The orientation of the model - * @param outlineWidth The width of the outline - * @param innerColor The color of the pixels of the outline closest to the model - * @param outerColor The color of the pixels of the outline furthest away from the model - */ - private void drawModelOutline(Model model, int localX, int localY, int localZ, int orientation, int outlineWidth, Color innerColor, Color outerColor) - { - if (outlineWidth <= 0) - { - return; - } - - isReset = false; - usedSinceLastCheck = true; - - MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider(); - BufferedImage image = (BufferedImage) bufferProvider.getImage(); - - clipX1 = client.getViewportXOffset(); - clipY1 = client.getViewportYOffset(); - clipX2 = client.getViewportWidth() + clipX1; - clipY2 = client.getViewportHeight() + clipY1; - imageWidth = image.getWidth(); - imageHeight = image.getHeight(); - final int pixelAmount = imageWidth * imageHeight; - - resetVisited(pixelAmount); - resetOutline(outlineWidth); - - if (!projectVertices(model, - localX, localY, localZ, orientation)) - { - // No vertex of the model is visible on the screen, so we can - // assume there are no parts of the model to outline. - return; - } - - simulateModelRasterizationForOutline(model); - - renderOutline(image, outlineWidth, innerColor, outerColor); - } - - @Deprecated(forRemoval = true, since = "4.9.2") - public void drawOutline(NPC npc, int outlineWidth, Color color) - { - drawOutline(npc, outlineWidth, color, color); - } - - @Deprecated(forRemoval = true, since = "4.9.2") - public void drawOutline(NPC npc, int outlineWidth, Color innerColor, Color outerColor) - { - int size = 1; - NPCComposition composition = npc.getTransformedComposition(); - if (composition != null) - { - size = composition.getSize(); - } - - LocalPoint lp = npc.getLocalLocation(); - if (lp != null) - { - // NPCs z position are calculated based on the tile height of the northeastern tile - final int northEastX = lp.getX() + Perspective.LOCAL_TILE_SIZE * (size - 1) / 2; - final int northEastY = lp.getY() + Perspective.LOCAL_TILE_SIZE * (size - 1) / 2; - final LocalPoint northEastLp = new LocalPoint(northEastX, northEastY); - - drawModelOutline(npc.getModel(), lp.getX(), lp.getY(), - Perspective.getTileHeight(client, northEastLp, client.getPlane()), - npc.getCurrentOrientation(), outlineWidth, innerColor, outerColor); - } - } - - @Deprecated(forRemoval = true, since = "4.9.2") - public void drawOutline(Player player, int outlineWidth, Color color) - { - drawOutline(player, outlineWidth, color, color); - } - - @Deprecated(forRemoval = true, since = "4.9.2") - public void drawOutline(Player player, int outlineWidth, Color innerColor, Color outerColor) - { - LocalPoint lp = player.getLocalLocation(); - if (lp != null) - { - drawModelOutline(player.getModel(), lp.getX(), lp.getY(), - Perspective.getTileHeight(client, lp, client.getPlane()), - player.getCurrentOrientation(), outlineWidth, innerColor, outerColor); - } - } - - @Deprecated(forRemoval = true, since = "4.9.2") - public void drawOutline(GameObject gameObject, int outlineWidth, Color innerColor, Color outerColor) - { - LocalPoint lp = gameObject.getLocalLocation(); - if (lp != null) - { - Renderable renderable = gameObject.getRenderable(); - if (renderable == null) - { - return; - } - - drawModelOutline(renderable instanceof Model ? (Model) renderable : renderable.getModel(), lp.getX(), lp.getY(), - Perspective.getTileHeight(client, lp, gameObject.getPlane()), - gameObject.getModelOrientation(), outlineWidth, innerColor, outerColor); - } - } - - @Deprecated(forRemoval = true, since = "4.9.2") - public void drawOutline(GroundObject groundObject, int outlineWidth, Color innerColor, Color outerColor) - { - LocalPoint lp = groundObject.getLocalLocation(); - if (lp != null) - { - drawModelOutline(groundObject.getModel(), lp.getX(), lp.getY(), - Perspective.getTileHeight(client, lp, client.getPlane()), - 0, outlineWidth, innerColor, outerColor); - } - } - - private void drawOutline(ItemLayer tileItemPile, int outlineWidth, Color innerColor, Color outerColor) - { - LocalPoint lp = tileItemPile.getLocalLocation(); - if (lp != null) - { - Model model = tileItemPile.getModelBottom(); - if (model != null) - { - drawModelOutline(model, lp.getX(), lp.getY(), - Perspective.getTileHeight(client, lp, tileItemPile.getPlane()), - 0, outlineWidth, innerColor, outerColor); - } - - model = tileItemPile.getModelMiddle(); - if (model != null) - { - drawModelOutline(model, lp.getX(), lp.getY(), - Perspective.getTileHeight(client, lp, tileItemPile.getPlane()), - 0, outlineWidth, innerColor, outerColor); - } - - model = tileItemPile.getModelTop(); - if (model != null) - { - drawModelOutline(model, lp.getX(), lp.getY(), - Perspective.getTileHeight(client, lp, tileItemPile.getPlane()), - 0, outlineWidth, innerColor, outerColor); - } - } - } - - private void drawOutline(DecorativeObject decorativeObject, int outlineWidth, Color innerColor, Color outerColor) - { - LocalPoint lp = decorativeObject.getLocalLocation(); - if (lp != null) - { - Renderable renderable1 = decorativeObject.getRenderable(); - if (renderable1 != null) - { - Model model = renderable1 instanceof Model ? (Model) renderable1 : renderable1.getModel(); - if (model != null) - { - drawModelOutline(model, - lp.getX() + decorativeObject.getXOffset(), - lp.getY() + decorativeObject.getYOffset(), - Perspective.getTileHeight(client, lp, decorativeObject.getPlane()), - 0, outlineWidth, innerColor, outerColor); - } - } - - Renderable renderable2 = decorativeObject.getRenderable2(); - if (renderable2 != null) - { - Model model = renderable2 instanceof Model ? (Model) renderable2 : renderable2.getModel(); - if (model != null) - { - // Offset is not used for the second model - drawModelOutline(model, lp.getX(), lp.getY(), - Perspective.getTileHeight(client, lp, decorativeObject.getPlane()), - 0, outlineWidth, innerColor, outerColor); - } - } - } - } - - private void drawOutline(WallObject wallObject, int outlineWidth, Color innerColor, Color outerColor) - { - LocalPoint lp = wallObject.getLocalLocation(); - if (lp != null) - { - Model model = wallObject.getModelA(); - if (model != null) - { - drawModelOutline(model, lp.getX(), lp.getY(), - Perspective.getTileHeight(client, lp, wallObject.getPlane()), - wallObject.getOrientationA(), outlineWidth, innerColor, outerColor); - } - - model = wallObject.getModelB(); - if (model != null) - { - drawModelOutline(model, lp.getX(), lp.getY(), - Perspective.getTileHeight(client, lp, wallObject.getPlane()), - wallObject.getOrientationB(), outlineWidth, innerColor, outerColor); - } - } - } - - @Deprecated(forRemoval = true, since = "4.9.2") - public void drawOutline(TileObject tileObject, int outlineWidth, Color color) - { - drawOutline(tileObject, outlineWidth, color, color); - } - - @Deprecated(forRemoval = true, since = "4.9.2") - public void drawOutline(TileObject tileObject, - int outlineWidth, Color innerColor, Color outerColor) - { - if (tileObject instanceof GameObject) - { - drawOutline((GameObject) tileObject, outlineWidth, innerColor, outerColor); - } - else if (tileObject instanceof GroundObject) - { - drawOutline((GroundObject) tileObject, outlineWidth, innerColor, outerColor); - } - else if (tileObject instanceof ItemLayer) - { - drawOutline((ItemLayer) tileObject, outlineWidth, innerColor, outerColor); - } - else if (tileObject instanceof DecorativeObject) - { - drawOutline((DecorativeObject) tileObject, outlineWidth, innerColor, outerColor); - } - else if (tileObject instanceof WallObject) - { - drawOutline((WallObject) tileObject, outlineWidth, innerColor, outerColor); - } - } - - @Value - @RequiredArgsConstructor - static class PixelDistanceAlpha - { - int outerAlpha; - int distArrayPos; - } -} \ No newline at end of file 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 ef7de6c3b9..05a9f07ef4 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLite.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLite.java @@ -354,7 +354,7 @@ public class RuneLite oprsExternalPluginManager.setOutdated(isOutdated); // Update external plugins - oprsExternalPluginManager.update(); //TODO: Re-enable after fixing actions for new repo + oprsExternalPluginManager.update(); // Load the plugins, but does not start them yet. // This will initialize configuration diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalBasePluginLoader.java b/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalBasePluginLoader.java new file mode 100644 index 0000000000..ce062bd49e --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalBasePluginLoader.java @@ -0,0 +1,24 @@ +package net.runelite.client.plugins; + +import java.nio.file.Path; +import lombok.extern.slf4j.Slf4j; +import org.pf4j.BasePluginLoader; +import org.pf4j.PluginClassLoader; +import org.pf4j.PluginClasspath; +import org.pf4j.PluginDescriptor; +import org.pf4j.PluginManager; + +@Slf4j +class OPRSExternalBasePluginLoader extends BasePluginLoader +{ + OPRSExternalBasePluginLoader(PluginManager pluginManager, PluginClasspath pluginClasspath) + { + super(pluginManager, pluginClasspath); + } + + @Override + protected PluginClassLoader createPluginClassLoader(Path pluginPath, PluginDescriptor pluginDescriptor) + { + return new OPRSExternalClassLoader(pluginManager, pluginDescriptor, getClass().getClassLoader()); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalClassLoader.java b/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalClassLoader.java new file mode 100644 index 0000000000..a0cf9d0c47 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalClassLoader.java @@ -0,0 +1,142 @@ +package net.runelite.client.plugins; + +import java.lang.invoke.MethodHandles; +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +import net.runelite.client.util.ReflectUtil; +import org.pf4j.ClassLoadingStrategy; +import org.pf4j.PluginClassLoader; +import org.pf4j.PluginDependency; +import org.pf4j.PluginDescriptor; +import org.pf4j.PluginManager; + +@Slf4j +class OPRSExternalClassLoader extends PluginClassLoader implements ReflectUtil.PrivateLookupableClassLoader +{ + private static final String JAVA_PACKAGE_PREFIX = "java."; + private static final String PLUGIN_PACKAGE_PREFIX = "org.pf4j."; + + @Getter + @Setter + private MethodHandles.Lookup lookup; + + private final PluginManager pluginManager; + private final PluginDescriptor pluginDescriptor; + private final ClassLoadingStrategy classLoadingStrategy; + + OPRSExternalClassLoader(PluginManager pluginManager, PluginDescriptor pluginDescriptor, ClassLoader parent) + { + super(pluginManager, pluginDescriptor, parent); + + this.pluginManager = pluginManager; + this.pluginDescriptor = pluginDescriptor; + this.classLoadingStrategy = ClassLoadingStrategy.PDA; + + ReflectUtil.installLookupHelper(this); + } + + @Override + public Class defineClass0(String name, byte[] b, int off, int len) throws ClassFormatError + { + return super.defineClass(name, b, off, len); + } + + @Override + protected Class loadClassFromDependencies(String className) + { + log.trace("Search in dependencies for class '{}'", className); + + List dependencies = pluginDescriptor.getDependencies(); + for (PluginDependency dependency : dependencies) + { + ClassLoader classLoader = pluginManager.getPluginClassLoader(dependency.getPluginId()); + + // If the dependency is marked as optional, its class loader might not be available. + if (classLoader == null && dependency.isOptional()) + { + continue; + } + + try + { + if (classLoader != null) + { + return classLoader.loadClass(className); + } + } + catch (ClassNotFoundException e) + { + // try next dependency + } + } + + return null; + } + + @Override + public Class loadClass(String className) throws ClassNotFoundException + { + synchronized (getClassLoadingLock(className)) + { + // first check whether it's a system class, delegate to the system loader + if (className.startsWith(JAVA_PACKAGE_PREFIX)) + { + return findSystemClass(className); + } + + // if the class is part of the plugin engine use parent class loader + if (className.startsWith(PLUGIN_PACKAGE_PREFIX) && !className.startsWith("org.pf4j.demo")) + { +// log.trace("Delegate the loading of PF4J class '{}' to parent", className); + return getParent().loadClass(className); + } + + log.trace("Received request to load class '{}'", className); + + // second check whether it's already been loaded + Class loadedClass = findLoadedClass(className); + if (loadedClass != null) + { + log.trace("Found loaded class '{}'", className); + return loadedClass; + } + + for (ClassLoadingStrategy.Source classLoadingSource : this.classLoadingStrategy.getSources()) + { + Class c = null; + try + { + switch (classLoadingSource) + { + case APPLICATION: + c = super.loadClass(className); + break; + case PLUGIN: + c = findClass(className); + break; + case DEPENDENCIES: + c = loadClassFromDependencies(className); + break; + } + } + catch (ClassNotFoundException ignored) + { + } + + if (c != null) + { + log.trace("Found class '{}' in {} classpath", className, classLoadingSource); + return c; + } + else + { + log.trace("Couldn't find class '{}' in {} classpath", className, classLoadingSource); + } + } + + throw new ClassNotFoundException(className); + } + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalJarPluginLoader.java b/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalJarPluginLoader.java new file mode 100644 index 0000000000..78cf086a8f --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalJarPluginLoader.java @@ -0,0 +1,26 @@ +package net.runelite.client.plugins; + +import java.nio.file.Path; +import lombok.extern.slf4j.Slf4j; +import org.pf4j.JarPluginLoader; +import org.pf4j.PluginClassLoader; +import org.pf4j.PluginDescriptor; +import org.pf4j.PluginManager; + +@Slf4j +class OPRSExternalJarPluginLoader extends JarPluginLoader +{ + public OPRSExternalJarPluginLoader(PluginManager pluginManager) + { + super(pluginManager); + } + + @Override + public ClassLoader loadPlugin(Path pluginPath, PluginDescriptor pluginDescriptor) + { + PluginClassLoader pluginClassLoader = new OPRSExternalClassLoader(pluginManager, pluginDescriptor, getClass().getClassLoader()); + pluginClassLoader.addFile(pluginPath.toFile()); + + return pluginClassLoader; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalPf4jPluginManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalPf4jPluginManager.java index 4c6ec404fe..9476dda610 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalPf4jPluginManager.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalPf4jPluginManager.java @@ -17,13 +17,11 @@ import java.util.Set; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import lombok.extern.slf4j.Slf4j; -import org.pf4j.BasePluginLoader; import org.pf4j.CompoundPluginLoader; import org.pf4j.CompoundPluginRepository; import org.pf4j.DefaultPluginManager; import org.pf4j.DependencyResolver; import org.pf4j.DevelopmentPluginRepository; -import org.pf4j.JarPluginLoader; import org.pf4j.JarPluginRepository; import org.pf4j.ManifestPluginDescriptorFinder; import org.pf4j.PluginAlreadyLoadedException; @@ -105,8 +103,8 @@ class OPRSExternalPf4jPluginManager extends DefaultPluginManager protected PluginLoader createPluginLoader() { return new CompoundPluginLoader() - .add(new BasePluginLoader(this, new OPRSExternalPluginClasspath()), this::isDevelopment) - .add(new JarPluginLoader(this), this::isNotDevelopment); + .add(new OPRSExternalBasePluginLoader(this, new OPRSExternalPluginClasspath()), this::isDevelopment) + .add(new OPRSExternalJarPluginLoader(this), this::isNotDevelopment); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalPluginManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalPluginManager.java index e03672694f..5959e03b01 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalPluginManager.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalPluginManager.java @@ -1203,4 +1203,4 @@ public class OPRSExternalPluginManager { return URLEncoder.encode(s, StandardCharsets.UTF_8); } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java index 2ae6cd40d7..7e2003efb4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java @@ -39,7 +39,13 @@ import com.google.inject.Injector; import com.google.inject.Key; import com.google.inject.Module; import java.io.IOException; +import java.lang.invoke.CallSite; +import java.lang.invoke.LambdaMetafactory; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -69,9 +75,12 @@ import net.runelite.client.eventbus.Subscribe; import net.runelite.client.events.PluginChanged; import net.runelite.client.events.SessionClose; import net.runelite.client.events.SessionOpen; +import net.runelite.client.task.Schedule; +import net.runelite.client.task.ScheduledMethod; import net.runelite.client.task.Scheduler; import net.runelite.client.ui.SplashScreen; import net.runelite.client.util.GameEventManager; +import net.runelite.client.util.ReflectUtil; @Singleton @Slf4j @@ -651,14 +660,59 @@ public class PluginManager private void schedule(Plugin plugin) { - // note to devs: this method will almost certainly merge conflict in the future, just apply the changes in the scheduler instead - scheduler.registerObject(plugin); + for (Method method : plugin.getClass().getMethods()) + { + Schedule schedule = method.getAnnotation(Schedule.class); + + if (schedule == null) + { + continue; + } + + Runnable runnable = null; + try + { + final Class clazz = method.getDeclaringClass(); + final MethodHandles.Lookup caller = ReflectUtil.privateLookupIn(clazz); + final MethodType subscription = MethodType.methodType(method.getReturnType(), method.getParameterTypes()); + final MethodHandle target = caller.findVirtual(clazz, method.getName(), subscription); + final CallSite site = LambdaMetafactory.metafactory( + caller, + "run", + MethodType.methodType(Runnable.class, clazz), + subscription, + target, + subscription); + + final MethodHandle factory = site.getTarget(); + runnable = (Runnable) factory.bindTo(plugin).invokeExact(); + } + catch (Throwable e) + { + log.warn("Unable to create lambda for method {}", method, e); + } + + ScheduledMethod scheduledMethod = new ScheduledMethod(schedule, method, plugin, runnable); + log.debug("Scheduled task {}", scheduledMethod); + + scheduler.addScheduledMethod(scheduledMethod); + } } private void unschedule(Plugin plugin) { - // note to devs: this method will almost certainly merge conflict in the future, just apply the changes in the scheduler instead - scheduler.unregisterObject(plugin); + List methods = new ArrayList<>(scheduler.getScheduledMethods()); + + for (ScheduledMethod method : methods) + { + if (method.getObject() != plugin) + { + continue; + } + + log.debug("Removing scheduled task {}", method); + scheduler.removeScheduledMethod(method); + } } /** @@ -734,4 +788,4 @@ public class PluginManager }) .collect(Collectors.toList()); } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index 83339d9d3e..27e8727cb2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -115,6 +115,7 @@ import net.runelite.client.ui.FontManager; import net.runelite.client.ui.PluginPanel; import net.runelite.client.ui.components.ColorJButton; import net.runelite.client.ui.components.ComboBoxListRenderer; +import net.runelite.client.ui.components.ToggleButton; import net.runelite.client.ui.components.colorpicker.ColorPickerManager; import net.runelite.client.ui.components.colorpicker.RuneliteColorPicker; import net.runelite.client.util.ColorUtil; @@ -487,8 +488,7 @@ class ConfigPanel extends PluginPanel if (cid.getType() == boolean.class) { - JCheckBox checkbox = new JCheckBox(); - checkbox.setBackground(ColorScheme.LIGHT_GRAY_COLOR); + JCheckBox checkbox = new ToggleButton(); checkbox.setSelected(Boolean.parseBoolean(configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName()))); checkbox.addActionListener(ae -> changeConfiguration(checkbox, cd, cid)); @@ -864,8 +864,8 @@ class ConfigPanel extends PluginPanel { String option = String.valueOf(obj).toLowerCase().replace("_", " "); - JCheckBox checkbox = new JCheckBox(option); - checkbox.setBackground(ColorScheme.LIGHT_GRAY_COLOR); + JCheckBox checkbox = new ToggleButton(option); + checkbox.setBackground(ColorScheme.DARK_GRAY_COLOR); checkbox.setSelected(enumSet.contains(obj)); jcheckboxes.add(checkbox); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java index b40cdd2e62..a817f76778 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java @@ -26,41 +26,18 @@ package net.runelite.client.plugins.config; import java.awt.Dimension; -import java.awt.image.BufferedImage; import java.util.List; -import javax.swing.ImageIcon; -import javax.swing.JToggleButton; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.SwingUtil; +import net.runelite.client.ui.components.ToggleButton; -class PluginToggleButton extends JToggleButton +class PluginToggleButton extends ToggleButton { - private static final ImageIcon ON_SWITCHER; - private static final ImageIcon OFF_SWITCHER; - - static - { - BufferedImage onSwitcher = ImageUtil.loadImageResource(ConfigPanel.class, "switcher_on.png"); - ON_SWITCHER = new ImageIcon(ImageUtil.recolorImage(onSwitcher, ColorScheme.BRAND_BLUE)); - OFF_SWITCHER = new ImageIcon(ImageUtil.flipImage( - ImageUtil.luminanceScale( - ImageUtil.grayscaleImage(onSwitcher), - 0.61f - ), - true, - false - )); - } - private String conflictString = ""; public PluginToggleButton() { - super(OFF_SWITCHER); - setSelectedIcon(ON_SWITCHER); - SwingUtil.removeButtonDecorations(this); + super(); setPreferredSize(new Dimension(25, 0)); + addItemListener(l -> updateTooltip()); updateTooltip(); } diff --git a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java index c529b073da..6afd761a68 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java @@ -78,7 +78,7 @@ import okhttp3.Response; public class ClientLoader implements Supplier { private static final String INJECTED_CLIENT_NAME = "/injected-client.oprs"; - private static final int NUM_ATTEMPTS = 6; + private static final int NUM_ATTEMPTS = 0; private static File LOCK_FILE = new File(RuneLite.CACHE_DIR, "cache.lock"); private static File VANILLA_CACHE = new File(RuneLite.CACHE_DIR, "vanilla.cache"); private static File PATCHED_CACHE = new File(RuneLite.CACHE_DIR, "patched.cache"); diff --git a/runelite-client/src/main/java/net/runelite/client/task/Scheduler.java b/runelite-client/src/main/java/net/runelite/client/task/Scheduler.java index 67ba137e63..8ecf6ab665 100644 --- a/runelite-client/src/main/java/net/runelite/client/task/Scheduler.java +++ b/runelite-client/src/main/java/net/runelite/client/task/Scheduler.java @@ -24,16 +24,10 @@ */ package net.runelite.client.task; -import java.lang.invoke.CallSite; -import java.lang.invoke.LambdaMetafactory; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.time.Duration; import java.time.Instant; -import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; @@ -66,63 +60,6 @@ public class Scheduler return Collections.unmodifiableList(scheduledMethods); } - public void registerObject(Object obj) - { - for (Method method : obj.getClass().getMethods()) - { - Schedule schedule = method.getAnnotation(Schedule.class); - - if (schedule == null) - { - continue; - } - - Runnable runnable = null; - try - { - final Class clazz = method.getDeclaringClass(); - final MethodHandles.Lookup caller = MethodHandles.privateLookupIn(clazz, MethodHandles.lookup()); - final MethodType subscription = MethodType.methodType(method.getReturnType(), method.getParameterTypes()); - final MethodHandle target = caller.findVirtual(clazz, method.getName(), subscription); - final CallSite site = LambdaMetafactory.metafactory( - caller, - "run", - MethodType.methodType(Runnable.class, clazz), - subscription, - target, - subscription); - - final MethodHandle factory = site.getTarget(); - runnable = (Runnable) factory.bindTo(obj).invokeExact(); - } - catch (Throwable e) - { - log.warn("Unable to create lambda for method {}", method, e); - } - - ScheduledMethod scheduledMethod = new ScheduledMethod(schedule, method, obj, runnable); - log.debug("Scheduled task {}", scheduledMethod); - - addScheduledMethod(scheduledMethod); - } - } - - public void unregisterObject(Object obj) - { - List methods = new ArrayList<>(getScheduledMethods()); - - for (ScheduledMethod method : methods) - { - if (method.getObject() != obj) - { - continue; - } - - log.debug("Removing scheduled task {}", method); - removeScheduledMethod(method); - } - } - public void tick() { Instant now = Instant.now(); diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/ToggleButton.java b/runelite-client/src/main/java/net/runelite/client/ui/components/ToggleButton.java new file mode 100644 index 0000000000..f6a7007d26 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/ui/components/ToggleButton.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2019 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.client.ui.components; + +import java.awt.image.BufferedImage; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import net.runelite.client.ui.ColorScheme; +import net.runelite.client.util.ImageUtil; +import net.runelite.client.util.SwingUtil; + +public class ToggleButton extends JCheckBox +{ + private static final ImageIcon ON_SWITCHER; + private static final ImageIcon OFF_SWITCHER; + private static final ImageIcon DISABLED_SWITCHER; + + static + { + BufferedImage onSwitcher = ImageUtil.loadImageResource(ToggleButton.class, "switcher_on.png"); + ON_SWITCHER = new ImageIcon(ImageUtil.recolorImage(onSwitcher, ColorScheme.BRAND_BLUE)); + OFF_SWITCHER = new ImageIcon(ImageUtil.flipImage( + ImageUtil.luminanceScale( + ImageUtil.grayscaleImage(onSwitcher), + 0.61f + ), + true, + false + )); + DISABLED_SWITCHER = new ImageIcon(ImageUtil.flipImage( + ImageUtil.luminanceScale( + ImageUtil.grayscaleImage(onSwitcher), + 0.4f + ), + true, + false + )); + } + + public ToggleButton() + { + super(OFF_SWITCHER); + setSelectedIcon(ON_SWITCHER); + setDisabledIcon(DISABLED_SWITCHER); + SwingUtil.removeButtonDecorations(this); + } + + public ToggleButton(String text) + { + super(text, OFF_SWITCHER, false); + setSelectedIcon(ON_SWITCHER); + setDisabledIcon(DISABLED_SWITCHER); + SwingUtil.removeButtonDecorations(this); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/ui/skin/ObsidianSkin.java b/runelite-client/src/main/java/net/runelite/client/ui/skin/ObsidianSkin.java index 92620713fc..8615d70788 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/skin/ObsidianSkin.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/skin/ObsidianSkin.java @@ -59,7 +59,7 @@ public class ObsidianSkin extends SubstanceSkin ObsidianSkin() { final SubstanceSkin.ColorSchemes schemes = SubstanceSkin - .getColorSchemes(getClass().getResource(NAME + ".colorschemes")); + .getColorSchemes(getClass().getResourceAsStream(NAME + ".colorschemes")); final SubstanceColorScheme activeScheme = schemes.get("RuneLite Active"); final SubstanceColorScheme enabledScheme = schemes.get("RuneLite Enabled"); @@ -119,7 +119,7 @@ public class ObsidianSkin extends SubstanceSkin .get("RuneLite Decorations Watermark"); this.registerDecorationAreaSchemeBundle(decorationsSchemeBundle, decorationsWatermarkScheme, - DecorationAreaType.TOOLBAR, DecorationAreaType.GENERAL, DecorationAreaType.FOOTER); + DecorationAreaType.TOOLBAR, DecorationAreaType.CONTROL_PANE, DecorationAreaType.FOOTER); final SubstanceColorSchemeBundle headerSchemeBundle = new SubstanceColorSchemeBundle(activeScheme, enabledScheme, enabledScheme); @@ -184,7 +184,6 @@ public class ObsidianSkin extends SubstanceSkin } }; - this.watermark = null; this.fillPainter = new FractionBasedFillPainter("RuneLite", new float[]{0.0f, 0.5f, 1.0f}, new ColorSchemeSingleColorQuery[]{ColorSchemeSingleColorQuery.ULTRALIGHT, diff --git a/runelite-client/src/main/java/net/runelite/client/util/OSXUtil.java b/runelite-client/src/main/java/net/runelite/client/util/OSXUtil.java index de099a1646..3a90759ec9 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/OSXUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/OSXUtil.java @@ -24,10 +24,9 @@ */ package net.runelite.client.util; -import com.apple.eawt.Application; -import com.apple.eawt.FullScreenUtilities; import javax.swing.JFrame; import lombok.extern.slf4j.Slf4j; +import org.madlonkay.desktopsupport.DesktopSupport; /** * A class with OSX-specific functions to improve integration. @@ -44,7 +43,7 @@ public class OSXUtil { if (OSType.getOSType() == OSType.MacOS) { - FullScreenUtilities.setWindowCanFullScreen(gui, true); + DesktopSupport.getSupport().setWindowCanFullScreen(gui, true); log.debug("Enabled fullscreen on macOS"); } } @@ -54,8 +53,7 @@ public class OSXUtil */ public static void requestUserAttention() { - Application app = Application.getApplication(); - app.requestUserAttention(true); + DesktopSupport.getSupport().requestUserAttention(true); log.debug("Requested user attention on macOS"); } @@ -64,8 +62,7 @@ public class OSXUtil */ public static void requestForeground() { - Application app = Application.getApplication(); - app.requestForeground(true); + DesktopSupport.getSupport().requestForeground(true); log.debug("Forced focus on macOS"); } } diff --git a/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java b/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java index 22e46213e2..11b6bbd479 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java @@ -62,6 +62,7 @@ import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.NavigationButton; import net.runelite.client.ui.components.CustomScrollBarUI; import net.runelite.client.ui.components.SliderUI; +import org.pushingpixels.substance.api.SubstanceSlices; import org.pushingpixels.substance.internal.SubstanceSynapse; /** @@ -217,7 +218,7 @@ public class SwingUtil button.setSize(scaledImage.getWidth(), scaledImage.getHeight()); button.setToolTipText(navigationButton.getTooltip()); button.setIcon(new ImageIcon(scaledImage)); - button.putClientProperty(SubstanceSynapse.FLAT_LOOK, Boolean.TRUE); + button.putClientProperty(SubstanceSynapse.BACKGROUND_APPEARANCE_STRATEGY, SubstanceSlices.BackgroundAppearanceStrategy.FLAT); button.setFocusable(false); button.addActionListener(e -> { diff --git a/runelite-client/src/main/resources/net/runelite/client/ui/components/switcher_on.png b/runelite-client/src/main/resources/net/runelite/client/ui/components/switcher_on.png new file mode 100644 index 0000000000..e49f318005 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/ui/components/switcher_on.png differ diff --git a/runelite-jshell/runelite-jshell.gradle.kts b/runelite-jshell/runelite-jshell.gradle.kts index dd7aaa7643..438140edd1 100644 --- a/runelite-jshell/runelite-jshell.gradle.kts +++ b/runelite-jshell/runelite-jshell.gradle.kts @@ -32,8 +32,8 @@ dependencies { compileOnly(group = "org.projectlombok", name = "lombok", version = ProjectVersions.lombokVersion) implementation(group = "com.google.code.findbugs", name = "jsr305", version = "3.0.2") - implementation(group = "com.google.inject", name = "guice", version = "4.1.0", classifier = "no_aop") + implementation(group = "com.google.inject", name = "guice", version = "5.0.1") implementation(group = "com.fifesoft", name = "rsyntaxtextarea", version = "3.1.2") implementation(group = "com.fifesoft", name = "autocomplete", version = "3.1.1") - implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.12") + implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") } \ No newline at end of file diff --git a/runelite-mixins/runelite-mixins.gradle.kts b/runelite-mixins/runelite-mixins.gradle.kts index f6416addc9..c69b88f236 100644 --- a/runelite-mixins/runelite-mixins.gradle.kts +++ b/runelite-mixins/runelite-mixins.gradle.kts @@ -25,9 +25,9 @@ description = "RuneLite Mixins" dependencies { - compileOnly(group = "com.google.guava", name = "guava", version = "23.2-jre") + compileOnly(group = "com.google.guava", name = "guava", version = "30.1.1-jre") compileOnly(group = "javax.inject", name = "javax.inject", version = "1") - compileOnly(group = "org.slf4j", name = "slf4j-api", version = "1.7.12") + compileOnly(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") compileOnly(group = "commons-io", name = "commons-io", version = "2.8.0") compileOnly(project(":injection-annotations")) compileOnly(project(":runescape-api")) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java index 48f74e9d48..cf548e1f45 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/ScriptVMMixin.java @@ -65,7 +65,8 @@ public abstract class ScriptVMMixin implements RSClient { if (script != null) { - ScriptPreFired event = new ScriptPreFired((int) script.getHash(), rootScriptEvent); + ScriptPreFired event = new ScriptPreFired((int) script.getHash()); + event.setScriptEvent(rootScriptEvent); client.getCallbacks().post(event); } @@ -127,7 +128,7 @@ public abstract class ScriptVMMixin implements RSClient return true; case INVOKE: int scriptId = currentScript.getIntOperands()[currentScriptPC]; - client.getCallbacks().post(new ScriptPreFired(scriptId, null)); + client.getCallbacks().post(new ScriptPreFired(scriptId)); return false; case RETURN: client.getCallbacks().post(new ScriptPostFired((int) currentScript.getHash())); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java index c23c7cc483..5ef00b9b82 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/SoundEffectMixin.java @@ -35,7 +35,6 @@ import net.runelite.api.mixins.Replace; import net.runelite.api.mixins.Shadow; import net.runelite.rs.api.RSActor; import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSNPC; import net.runelite.rs.api.RSPcmStream; import net.runelite.rs.api.RSRawPcmStream; import net.runelite.rs.api.RSRawSound; @@ -53,18 +52,11 @@ public abstract class SoundEffectMixin implements RSClient @Inject private static RSActor lastSoundEffectSourceActor; - @Inject - private static int lastSoundEffectSourceNPCid; - @Copy("updateActorSequence") @Replace("updateActorSequence") @SuppressWarnings("InfiniteRecursion") public static void copy$updateActorSequence(RSActor actor, int size) { - if (actor instanceof RSNPC) - { - lastSoundEffectSourceNPCid = ((RSNPC) actor).getId(); - } lastSoundEffectSourceActor = actor; copy$updateActorSequence(actor, size); @@ -87,8 +79,6 @@ public abstract class SoundEffectMixin implements RSClient { // Regular sound effect SoundEffectPlayed event = new SoundEffectPlayed(lastSoundEffectSourceActor); - event.setNpcid(lastSoundEffectSourceNPCid); - lastSoundEffectSourceNPCid = -1; event.setSoundId(client.getQueuedSoundEffectIDs()[soundIndex]); event.setDelay(client.getQueuedSoundEffectDelays()[soundIndex]); client.getCallbacks().post(event); diff --git a/runelite-script-assembler-plugin/runelite-script-assembler-plugin.gradle.kts b/runelite-script-assembler-plugin/runelite-script-assembler-plugin.gradle.kts index 3afaafa440..e3bb7fc075 100644 --- a/runelite-script-assembler-plugin/runelite-script-assembler-plugin.gradle.kts +++ b/runelite-script-assembler-plugin/runelite-script-assembler-plugin.gradle.kts @@ -34,9 +34,9 @@ dependencies { implementation(project(":cache")) implementation(project(":runelite-api")) - implementation(group = "com.google.guava", name = "guava", version = "23.2-jre") + implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre") implementation(group = "org.apache.maven", name = "maven-plugin-api", version = "3.6.3") - implementation(group = "org.slf4j", name = "slf4j-nop", version = "1.7.12") + implementation(group = "org.slf4j", name = "slf4j-nop", version = "1.7.32") } tasks { diff --git a/runescape-client/runescape-client.gradle.kts b/runescape-client/runescape-client.gradle.kts index 9d52c9a84a..fe52c6c012 100644 --- a/runescape-client/runescape-client.gradle.kts +++ b/runescape-client/runescape-client.gradle.kts @@ -30,10 +30,9 @@ dependencies { implementation(project(":injection-annotations")) implementation(group = "org.bouncycastle", name = "bcprov-jdk15on", version = "1.52") - testImplementation(group = "junit", name = "junit", version = "4.12") - testImplementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.12") - testImplementation(group = "org.slf4j", name = "slf4j-simple", version = "1.7.12") + testImplementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") + testImplementation(group = "org.slf4j", name = "slf4j-simple", version = "1.7.32") } tasks { diff --git a/runescape-client/src/main/java/netscape/javascript/JSException.java b/runescape-client/src/main/java/netscape/javascript/JSException.java new file mode 100644 index 0000000000..3a67bd958a --- /dev/null +++ b/runescape-client/src/main/java/netscape/javascript/JSException.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package netscape.javascript; + +/** + * Thrown when an exception is raised in the JavaScript engine. This is merely + * a marker class to indicate an exception relating to the JavaScript + * interface. + */ +public class JSException extends RuntimeException { + private static final long serialVersionUID = 2778103758223661489L; + + /** + * Constructs a new JavaScript exception with null as it's detail message. + */ + public JSException() { + super(); + } + + /** + * Construct a new JavaScript exception with the specified detail message. + * + * @param s The detail message + */ + public JSException(String s) { + super(s); + } + + /** + * Construct a new JavaScript exception with the specified cause. + * + * @param t Throwable cause + */ + public JSException(Throwable t) { + super(t); + } +} \ No newline at end of file diff --git a/runescape-client/src/main/java/netscape/javascript/JSObject.java b/runescape-client/src/main/java/netscape/javascript/JSObject.java new file mode 100644 index 0000000000..8299df7e75 --- /dev/null +++ b/runescape-client/src/main/java/netscape/javascript/JSObject.java @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package netscape.javascript; + +import java.applet.Applet; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Iterator; +import java.util.ServiceLoader; + +/** + *

+ * Allows Java code to manipulate JavaScript objects. + *

+ * + *

+ * When a JavaScript object is passed or returned to Java code, it + * is wrapped in an instance of {@code JSObject}. When a + * {@code JSObject} instance is passed to the JavaScript engine, + * it is unwrapped back to its original JavaScript object. The + * {@code JSObject} class provides a way to invoke JavaScript + * methods and examine JavaScript properties. + *

+ * + *

Any data returned from the JavaScript engine to Java is + * converted to Java data types. Certain data passed to the JavaScript + * engine is converted to JavaScript data types. + *

+ * + */ +@SuppressWarnings("deprecation") +public abstract class JSObject { + /** + * Constructs a new JSObject. Users should neither call this method nor + * subclass JSObject. + */ + protected JSObject() { + } + + /** + * Calls a JavaScript method. Equivalent to + * "this.methodName(args[0], args[1], ...)" in JavaScript. + * + * @param methodName The name of the JavaScript method to be invoked. + * @param args the Java objects passed as arguments to the method. + * @return Result of the method. + * @throws JSException when an error is reported from the browser or + * JavaScript engine. + */ + public abstract Object call(String methodName, Object... args) throws JSException; + + /** + * Evaluates a JavaScript expression. The expression is a string of + * JavaScript source code which will be evaluated in the context given by + * "this". + * + * @param s The JavaScript expression. + * @return Result of the JavaScript evaluation. + * @throws JSException when an error is reported from the browser or + * JavaScript engine. + */ + public abstract Object eval(String s) throws JSException; + + /** + * Retrieves a named member of a JavaScript object. Equivalent to + * "this.name" in JavaScript. + * + * @param name The name of the JavaScript property to be accessed. + * @return The value of the propery. + * @throws JSException when an error is reported from the browser or + * JavaScript engine. + */ + public abstract Object getMember(String name) throws JSException; + + /** + * Sets a named member of a JavaScript object. Equivalent to + * "this.name = value" in JavaScript. + * + * @param name The name of the JavaScript property to be accessed. + * @param value The value of the propery. + * @throws JSException when an error is reported from the browser or + * JavaScript engine. + */ + public abstract void setMember(String name, Object value) throws JSException; + + /** + * Removes a named member of a JavaScript object. Equivalent + * to "delete this.name" in JavaScript. + * + * @param name The name of the JavaScript property to be removed. + * @throws JSException when an error is reported from the browser or + * JavaScript engine. + */ + public abstract void removeMember(String name) throws JSException; + + /** + * Retrieves an indexed member of a JavaScript object. Equivalent to + * "this[index]" in JavaScript. + * + * @param index The index of the array to be accessed. + * @return The value of the indexed member. + * @throws JSException when an error is reported from the browser or + * JavaScript engine. + */ + public abstract Object getSlot(int index) throws JSException; + + /** + * Sets an indexed member of a JavaScript object. Equivalent to + * "this[index] = value" in JavaScript. + * + * @param index The index of the array to be accessed. + * @param value The value to set + * @throws JSException when an error is reported from the browser or + * JavaScript engine. + */ + public abstract void setSlot(int index, Object value) throws JSException; + + /** + * Returns a JSObject for the window containing the given applet. This + * method only works when the Java code is running in a browser as an + * applet. The object returned may be used to access the HTML DOM directly. + * + * @param applet The applet. + * @return JSObject representing the window containing the given applet or + * {@code null} if we are not connected to a browser. + * @throws JSException when an error is reported from the browser or + * JavaScript engine or if applet is {@code null} + * + * @deprecated The Applet API is deprecated. See the + * + * java.applet package documentation for further information. + */ + + @Deprecated(since = "9") + @SuppressWarnings("exports") + public static JSObject getWindow(Applet applet) throws JSException { + return ProviderLoader.callGetWindow(applet); + } + + private static class ProviderLoader { + private static final JSObjectProvider provider; + + static { + provider = AccessController.doPrivileged( + new PrivilegedAction() { + @Override + public JSObjectProvider run() { + Iterator providers = + ServiceLoader.loadInstalled(JSObjectProvider.class).iterator(); + if (providers.hasNext()) { + return providers.next(); + } + return null; + } + } + ); + } + + private static JSObject callGetWindow(Applet applet) { + if (provider != null) { + return provider.getWindow(applet); + } + return null; + } + } +} \ No newline at end of file diff --git a/runescape-client/src/main/java/netscape/javascript/JSObjectProvider.java b/runescape-client/src/main/java/netscape/javascript/JSObjectProvider.java new file mode 100644 index 0000000000..4d69202cfe --- /dev/null +++ b/runescape-client/src/main/java/netscape/javascript/JSObjectProvider.java @@ -0,0 +1,20 @@ +package netscape.javascript; + +import java.applet.Applet; +import netscape.javascript.JSException; +import netscape.javascript.JSObject; + +@SuppressWarnings("deprecation") +public interface JSObjectProvider { + /** + * Return a JSObject for the window containing the given applet. + * Implementations of this class should return null if not connected to a + * browser, for example, when running in AppletViewer. + * + * @param applet The applet. + * @return JSObject for the window containing the given applet or null if we + * are not connected to a browser. + * @throws JSException when an error is encountered. + */ + public JSObject getWindow(Applet applet) throws JSException; +} diff --git a/wiki-scraper/wiki-scraper.gradle.kts b/wiki-scraper/wiki-scraper.gradle.kts index 383ab0db0d..ffc50e1a05 100644 --- a/wiki-scraper/wiki-scraper.gradle.kts +++ b/wiki-scraper/wiki-scraper.gradle.kts @@ -34,11 +34,11 @@ dependencies { compileOnly(group = "org.projectlombok", name = "lombok", version = ProjectVersions.lombokVersion) implementation(group = "com.google.code.gson", name = "gson", version = "2.8.5") - implementation(group = "com.google.guava", name = "guava", version = "23.2-jre") + implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre") implementation(group = "com.github.petitparser", name = "java-petitparser", version = "2.3.1") - implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "3.7.0") - implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.12") - implementation(group = "org.slf4j", name = "slf4j-simple", version = "1.7.12") + implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.1") + implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") + implementation(group = "org.slf4j", name = "slf4j-simple", version = "1.7.32") implementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = "5.7.0") }