Skip to content

fix(qol): drop FieldUtil reflective writes that crash on client 2.5.4#418

Merged
chsami merged 1 commit intochsami:developmentfrom
runsonmypc:fix/qol-remove-fieldutil
May 3, 2026
Merged

fix(qol): drop FieldUtil reflective writes that crash on client 2.5.4#418
chsami merged 1 commit intochsami:developmentfrom
runsonmypc:fix/qol-remove-fieldutil

Conversation

@runsonmypc
Copy link
Copy Markdown
Contributor

Summary

  • QoLPlugin.updateUiElements() reflectively wrote ColorScheme.BRAND_ORANGE and MicrobotPluginToggleButton.ON_SWITCHER via util/antiban/FieldUtil.setFinalStatic, which used sun.misc.Unsafe under the hood.
  • Upstream commit chsami/Microbot@048a44d213 deleted FieldUtil (zero call sites in the client tree, plus a forensic-bot fingerprint concern) and added UnsafeUsageGuardTest to block its return.
  • Result: against the official microbot-2.5.4.jar, this plugin throws NoClassDefFoundError: net/runelite/client/plugins/microbot/util/antiban/FieldUtil from every onGameStateChanged, cascading into BlockingEventManager timeouts and freezing the client until shutdown.

Fix

  • Remove the two FieldUtil.setFinalStatic calls.
  • Drop the now-unused imports (FieldUtil, ColorScheme, java.lang.reflect.Field).
  • Bump version 1.8.12 -> 1.8.13.

Behavioral impact

Behavior Status
pluginLabelColor (per-component) preserved
toggleButtonColor recolor on existing toggles via setSelectedIcon preserved
Global BRAND_ORANGE accent override dropped
Default ON_SWITCHER for newly-created toggles dropped

The two dropped behaviors were already partly cosmetic theater: client UI like MicrobotConfigPanel, MicrobotPluginListItem, and MicrobotPluginHubPanel read BRAND_ORANGE once at construction, so the override only retinted UI built after the override fired. There is no supported JDK 17+ replacement for writing static-final fields of another class. A proper accent-color hook would need to be exposed by the Microbot client/RuneLite UI layer.

Test plan

  • ./gradlew build -PpluginList=QoLPlugin succeeds (no compile errors).
  • Drop-in replacement of ~/.runelite/microbot-plugins/QoLPlugin.jar on a 2.5.4 client launches without NoClassDefFoundError and the canvas no longer freezes.

Upstream commit 048a44d213 deleted util/antiban/FieldUtil to remove
sun.misc.Unsafe usage, so QoLPlugin throws NoClassDefFoundError on
every game state change against the official 2.5.4 jar, cascading
into BlockingEventManager timeouts and freezing the canvas until
shutdown.

Removes the two FieldUtil.setFinalStatic calls that mutated
ColorScheme.BRAND_ORANGE and MicrobotPluginToggleButton.ON_SWITCHER,
plus the now-unused imports (FieldUtil, ColorScheme, java.lang.reflect.Field).
There is no supported JDK 17+ replacement for writing static-final
fields of another class (commons-lang3 FieldUtils.removeFinalModifier
is deprecated; VarHandle requires non-final declaration).

Per-instance label color and toggle icon recoloring (the parts that
don't require static-final mutation) are preserved.

Bumps version 1.8.12 -> 1.8.13.
@gmason0
Copy link
Copy Markdown
Contributor

gmason0 commented Apr 27, 2026

Doesn't this just get rid of the feature, rather than #415 that actually resolves this issue?

You could just remove the final modifier using reflection in-order to write to the field.

@chsami chsami merged commit 07bfbc0 into chsami:development May 3, 2026
1 check passed
chsami added a commit that referenced this pull request May 3, 2026
* Add Sisyphus: Infernal Pact plugin - Yama's Lair stepping-stone automation (#423)

* fix prayer bug and add trio mode to charge pillars (#408)

* Add Sisyphus: Infernal Pact plugin — Yama stepping-stone automation

Automates the Yama's Lair stepping-stone circuit for the Demonic Pacts League.

Features:
- Fixed waypoint route covering the full entry path and central circle
- Fire NPC detection (ID 15608) with 2-tile exclusion radius via dual-source polling
- Anti-backtracking via 3-stone history deque — always moves forward in the loop
- Rapid 200-400ms scheduler for near-instant stone hops
- Configurable stone count (default 666 for the Demonic Pacts task)
- Respects Microbot break handler

Author: Sisyphus (papakonnekt)

---------

Co-authored-by: chsami <sami.chkhachkhi@gmail.com>
Co-authored-by: JThomasDevs <95548936+JThomasDevs@users.noreply.github.com>

* fix(MKE_Wintertodt): brazier behavior, snowfall-safe fletch, antiban hardening (#422)

* fix(MKE_Wintertodt): brazier detection + non-blocking snowfall dodge

The exact-equals worldLocation filter for brazier objects in
analyzeGameState never matched live state (SE brazier at (1638,3997)
vs constant (1639,3998)), so the brazier / brokenBrazier / burningBrazier
slots were permanently null. Result: no light, no relight, no fix, and
NPE on feed-click. Replace with a within-3 filter anchored on the
player-stand tile (sides are 17 tiles apart so radius 3 still
unambiguously selects the chosen side).

dodgeSnowfallDamage's sleepUntilTrue (5s nominal) wedged the executor
for ~140s in practice (confirmed via "avg loop time: 141100ms" in round
logs), starving handleEating and nearly killing the player. Strip the
wait — the next tick's priority blocks already handle a broken/unlit
brazier. Make the whole dodge opt-in via new DodgeSnowfall config
(default off) since most players just rely on food/potions.

Also: drop the burningBrazier-not-null gate from FLETCH_LOGS fletch-
start and knife-preselect (fletching needs knife + roots, not a lit
brazier nearby), null-guard the BURN_LOGS feed click, only consume the
round-start light priority flag when a brazier is *definitively*
burning so cache lag at round start doesn't abandon it, and run
handleEating before dodgeSnowfallDamage in maintenance.

Bump 2.1.3 -> 2.1.7.

* feat(MKE_Wintertodt): snowfall-safe fletch tile + maintenance-first priority

Fletch on a tile one south of the brazier-stand tile (the same offset
the dodge logic uses) so we stop tanking snowfall AoE for an entire
root pile. Feeding/lighting/repair still walk back to the brazier.

Promote brazier fix/relight to the top of performMaintenanceTasks,
ahead of handleEating. When snowfall breaks the brazier, the repair
window closes fast (other players race for it) and an unlit brazier
means zero points until relit — both beat eating, which can wait a
tick. The per-state priority blocks remain as a safety net.

Bump version to 2.2.0 (new feature).

* fix(MKE_Wintertodt): walk to fletch tile only on fresh post-chop entry

Mid-fletch interruptions (brazier fix/light, eat, cold tick) don't
change state, so resume fletching wherever the player happens to be
standing instead of trekking back to the safe tile for a partial pile.
A new one-shot `needFletchTileWalk` is armed by `changeState` only on
entry into FLETCH_LOGS and cleared after the first walk.

Drop "(priority over eating)" from the maintenance log label since the
top-level handler also fires from CHOP_ROOTS / WAITING where there's
no eat to defer.

* fix(MKE_Wintertodt): antiban hardening + font-safe config icons

Issues surfaced by a code review of the maintenance-priority changes:

- handleBrazierMaintenance was firing a bare click() every 60ms while
  the repair animation ran (~30 clicks in 2s). Added a resetActions
  guard at the top + sleepGaussian(200, 150) before each click.
- handleBurnLogsState fix-block had no pre-click delay, inconsistent
  with its own relight-block and every other priority block. Added
  sleepGaussian(200, 150).
- Feed click was missing Rs2Antiban.actionCooldown(), so feeding
  bypassed the PlayStyle pause regime that chop/fletch already use.
- Action Cooldown log line now prints the actual chance value.

Config icons swapped to the Dingbats / Misc Symbols blocks, which
render reliably in the JVM emoji font. The previous icons (kitchen
knife / wrench, Pictographs block) silently dropped to tofu in the
client panel.

* fix(MKE_Wintertodt): drop pre-click delays in brazier emergency paths

Removed five sleepGaussian(200, 150) calls (50-350ms) that fired
before the fix/light click in handleBrazierMaintenance,
handleFletchLogsState, and handleBurnLogsState. These pre-click waits
cost the bot the repair race against other players when snowfall
broke the brazier. deselectSelectedItem already has its own internal
80ms sleep and natural mouse adds organic humanization downstream,
so the extra wait was pure dead time. Reaction now fires within ~1
tick (60ms) of detection plus mouse-travel time.

* fix(MKE_Wintertodt): route nudge/hover/spam-click through natural mouse

Five direct Microbot.getMouse().move(x, y) calls dispatched a
teleport MOUSE_MOVED event with no path, visually obvious as a bot:
- maybeNudgeMouse() fired after every chop/fletch/feed click
- pre-round-start hover before the round timer hit zero
- spam-click pre-hover during the wait-for-round phase

Added moveCursorHumanized(int, int) and moveCursorHumanized(Rectangle)
helpers that route through Microbot.naturalMouse.moveTo() when natural
mouse is available, falling back to the direct move only when it
isn't. The remaining no-arg Microbot.getMouse().click() in the spam
path is fine — it reads the live canvas mouse position (where natural
mouse just moved the cursor) and the click itself routes through the
natural-mouse path via planMovementOrFallback.

---------

Co-authored-by: runsonmypc <runsonmypc@users.noreply.github.com>

* fix(auto-looter): stop world-hopping while walking to/from bank (#421)

DefaultScript ran two concurrent schedulers (200ms state machine,
1000ms walk handler). The BANKING->LOOTING transition fired the
moment inventory emptied, before the walk back from the bank had
finished. The next LOOTING tick scanned Rs2GroundItem from the
bank tile, found nothing, and after 5 misses (~1s) called
Microbot.hopToWorld. Same hazard during stray-walk-back.

- Add isAwayFromBase() helper: true when initialPlayerLocation is
  unset, the player is moving, or distance from base exceeds
  distanceToStray.
- LOOTING now short-circuits while away from base. No scan, no
  failedLootAttempts increment, no world hop.
- BANKING stays put until inventory is empty AND the player is
  parked at the loot spot. failedLootAttempts resets on the
  transition so each return to the spot gets a fresh 5-tick window.

Refs #1747

Co-authored-by: runsonmypc <runsonmypc@users.noreply.github.com>

* feat(AIOAIO): record walks via destination polling (#419)

* feat(AIOAIO): record walks via destination polling

* fix(AIOAIO): suppress side-effect walks by target location, not timing

* fix(AIOAIO): capture walks via destination poll on WALK/CANCEL

* fix(qol): drop FieldUtil reflective writes that crash on client 2.5.4 (#418)

Upstream commit 048a44d213 deleted util/antiban/FieldUtil to remove
sun.misc.Unsafe usage, so QoLPlugin throws NoClassDefFoundError on
every game state change against the official 2.5.4 jar, cascading
into BlockingEventManager timeouts and freezing the canvas until
shutdown.

Removes the two FieldUtil.setFinalStatic calls that mutated
ColorScheme.BRAND_ORANGE and MicrobotPluginToggleButton.ON_SWITCHER,
plus the now-unused imports (FieldUtil, ColorScheme, java.lang.reflect.Field).
There is no supported JDK 17+ replacement for writing static-final
fields of another class (commons-lang3 FieldUtils.removeFinalModifier
is deprecated; VarHandle requires non-final declaration).

Per-instance label color and toggle icon recoloring (the parts that
don't require static-final mutation) are preserved.

Bumps version 1.8.12 -> 1.8.13.

Co-authored-by: runsonmypc <runsonmypc@users.noreply.github.com>

* fix(aiofighter): make NPC attack work inside instances (#417)

Inside an instance, npc.getWorldLocation() returns the instance-side
(high-corner template region) coord, while config.centerLocation() and
Rs2Player.getWorldLocation() are template/overworld coords. The radius
check at AttackNpcScript filtered out every NPC because the two sides
of distanceTo() were in different coordinate spaces, so the script
silently did nothing in any instance.

Convert the NPC location via WorldPoint.fromLocalInstance(client,
npc.getLocalLocation()) when the scene is instanced, for both the
radius/reachable filter and the path-distance sort. Bumps version to
2.1.7.

Co-authored-by: runsonmypc <runsonmypc@users.noreply.github.com>

* feat(Kraken): slayer-task gate, food check, spawn recovery, fix Leagues loot (#416)

* feat(Kraken): add Kraken boss plugin

AFK five-click loop: disturb 4 small whirlpools + main, let
auto-retaliate do the damage, detect Kraken NPC despawn, loot,
wait for respawn, repeat.

- Kraken uniques (tentacle, trident of the seas, jar of dirt, pet)
  are always looted regardless of user settings.
- Config kept minimal: extra-names list, optional GE-value loot
  toggle + min price.
- Click delays drawn from a skewed Gaussian (1800-2400ms, mode 2000)
  for humanization; all other waits use Rs2Random ranges.

* feat(Kraken): slayer-task gate, food check, spawn recovery, fix Leagues loot

- Slayer task gate via Rs2Slayer varbit + chat-message backstop; stops the
  plugin once the assigned task no longer contains "kraken".
- Stop-when-out-of-food toggle (default on), checked only at IDLE so a kill
  is never aborted mid-fight.
- FIGHTING now waits up to 8s for the Kraken to actually spawn before
  counting a kill — recovers cleanly when a small whirlpool was missed.
- Loot: drop unconditional addCoins/addUntradables. On Leagues, drops are
  account-bound and report as untradeable, which was sweeping up every
  noted stack (monkfish, battlestaves, soul runes).

* fix(Kraken): tighten disturb click cadence to ~180ms

A click alone is enough to register the disturb — no need to wait for an
attack to land. Drops total disturb sequence from ~8s to ~720ms while
keeping enough variance to avoid metronomic timing.

---------

Co-authored-by: runsonmypc <runsonmypc@users.noreply.github.com>

* fix(QoL): drop FieldUtil static-final hacks (#415)

* fix prayer bug and add trio mode to charge pillars (#408)

* fix(QoL): drop FieldUtil static-final hacks

FieldUtil no longer exists; stop mutating ColorScheme/ToggleButton
statics. Patch Swing via UIManager defaults + per-component updates,
queue UI refresh/restore safely, and keep toggles/labels consistent.

---------

Co-authored-by: chsami <sami.chkhachkhi@gmail.com>
Co-authored-by: JThomasDevs <95548936+JThomasDevs@users.noreply.github.com>

* fix(moonsofperil): retry walker to reach boss lobby reliably (#413)

walkToBoss called walkWithState(bossWorldPoint, 0) once (exact-tile match)
then fell back to walkFastCanvas(bossWorldPoint). When the walker exited
early on a single pass (cross-region transport, door handler interrupt)
the canvas-click fallback tried to click a tile dozens of tiles off-screen,
LocalPoint.fromWorld returned null, and the plugin looped forever without
the player ever moving.

Replace with a bounded retry loop: walkWithState(bp, 3) with 600ms spacing
and a 90s overall budget, breaking on distance<=3. Null-guard
Rs2Player.getWorldLocation() since it can transiently return null during
region transitions (observed NPE at BossHandler.java:50).

Callers (Blue/Eclipse/BloodMoonHandler, RewardHandler) only need scene
proximity -- each follows with its own exact-tile interaction.

Bump version 1.0.3 -> 1.0.4.

Co-authored-by: runsonmypc <runsonmypc@users.noreply.github.com>

* feat: add Shilo Village and Anywhere options to jewelry crafter (#414)

Replace brittle per-location furnace object IDs in CraftingLocation with a
name-based lookup anchored at the configured WorldPoint (or the player when
ANYWHERE), gated by a "Smelt" action check — matches AutoSmeltingScript's
pattern. Adds ANYWHERE (use the nearest smelt-capable furnace wherever the
player is) and SHILO_VILLAGE. Wires JewelryPlugin into debugPlugins for
local debug runs.

Co-authored-by: runsonmypc <runsonmypc@users.noreply.github.com>
Co-authored-by: chsami <sami.chkhachkhi@gmail.com>

---------

Co-authored-by: papakonnekt <42449974+papakonnekt@users.noreply.github.com>
Co-authored-by: JThomasDevs <95548936+JThomasDevs@users.noreply.github.com>
Co-authored-by: runsonmypc <45095641+runsonmypc@users.noreply.github.com>
Co-authored-by: runsonmypc <runsonmypc@users.noreply.github.com>
Co-authored-by: Dan G <danielginovker@gmail.com>
Co-authored-by: Haliax <18099301+TheHaliax@users.noreply.github.com>
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.

3 participants