Skip to content

fix: remove Applet dependency for non-applet OSRS client#1674

Open
mzarglis wants to merge 1 commit intochsami:mainfrom
mzarglis:fix/remove-applet-dependency
Open

fix: remove Applet dependency for non-applet OSRS client#1674
mzarglis wants to merge 1 commit intochsami:mainfrom
mzarglis:fix/remove-applet-dependency

Conversation

@mzarglis
Copy link

@mzarglis mzarglis commented Feb 4, 2026

Summary

The OSRS client no longer extends java.applet.Applet, causing a ClassCastException when running in debug mode via RuneLiteDebug:

java.lang.ClassCastException: class client cannot be cast to class java.applet.Applet
    at net.runelite.client.plugins.microbot.MicrobotClientLoader.loadClient(MicrobotClientLoader.java:198)

This PR updates the Microbot-specific client loading code to use the new ClientConfiguration interface, aligning it with the main RuneLite/ClientLoader implementation.

Changes

  • MicrobotRSAppletStub.java: Changed from implementing AppletStub to implementing ClientConfiguration interface, replacing showDocument() error handling with the new onError(String code) method
  • MicrobotClientLoader.java: Changed from ((Applet) rs).setStub() to rs.setConfiguration()
  • RuneLiteDebug.java: Replaced applet.init()/applet.start() with client.initialize() and added client.unblockStartup() after plugins start

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Walkthrough

The pull request migrates RuneLite's initialization architecture from an Applet-based system to a client-based configuration system. Changes span three files: RuneLiteDebug.java replaces applet lifecycle methods with client initialization calls and adds client.unblockStartup(); MicrobotClientLoader.java removes Applet casting and switches to Client.setConfiguration() with a configuration stub; MicrobotRSAppletStub.java changes from implementing AppletStub to implementing ClientConfiguration, replacing multiple applet-related methods with a centralized onError(String code) method for error handling.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removing Applet dependency from the OSRS client implementation to fix a ClassCastException.
Description check ✅ Passed The description is directly related to the changeset, explaining the ClassCastException issue, the solution using ClientConfiguration interface, and detailing all three modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
runelite-client/src/main/java/net/runelite/client/RuneLiteDebug.java (1)

322-399: ⚠️ Potential issue | 🟠 Major

Guard client calls when isOutdated is true.

isOutdated is defined as client == null, but client.initialize() and client.unblockStartup() are still called unconditionally, which will NPE if the client failed to load. Consider an early return or a hard fail before using client.

Suggested fix
-        client.initialize();
+        if (isOutdated)
+        {
+            throw new IllegalStateException("Client failed to load");
+        }
+        client.initialize();
@@
-        client.unblockStartup();
+        client.unblockStartup();

The OSRS client no longer extends java.applet.Applet, causing a
ClassCastException when running in debug mode.

Changes:
- MicrobotRSAppletStub: Changed from implementing AppletStub to
  implementing ClientConfiguration interface
- MicrobotClientLoader: Changed from ((Applet) rs).setStub() to
  rs.setConfiguration()
- RuneLiteDebug: Replaced applet.init()/start() with client.initialize()
  and added client.unblockStartup() after plugins start

This aligns the debug client loader with the main RuneLite/ClientLoader
implementation that already uses the new ClientConfiguration interface.
@mzarglis mzarglis force-pushed the fix/remove-applet-dependency branch from 0a24972 to 4419261 Compare February 4, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants