Skip to main content

Event Snapshots

com.n3plugins.sdk.events exposes passive recent-event snapshots for callers that need observation without owning RuneLite event-bus wiring. PacketUtils registers SdkEvents with RuneLite's event bus during suite startup and unregisters it during shutdown.

note

This is passive observation, not polling and not an action surface. Consumers read bounded recent snapshots; they do not click, walk, attack, or mutate game state through these APIs.

SdkEvents

SdkEvents.xpGained().forEach(event ->
log.debug("{} gained {}", event.getSkill(), event.getGainedXp()));

List<NpcLifecycleEvent> bankers = SdkEvents.npcSpawns().stream()
.filter(event -> "Banker".equals(event.getName()))
.collect(Collectors.toList());

Methods:

  • xpGained() - recent XpGainedEvent snapshots.
  • inventoryDeltas() - recent InventoryDeltaEvent snapshots.
  • npcSpawns() - recent NPC lifecycle snapshots where isSpawned() is true.
  • npcDespawns() - recent NPC lifecycle snapshots where isSpawned() is false.
  • npcLifecycle() - recent NPC spawn and despawn snapshots.
  • animationChanges() - recent AnimationChangeEvent snapshots.
  • projectileMovements() - recent ProjectileMovementEvent snapshots.
  • clear() - clears retained snapshots and tracker baselines.
  • trackerForTesting() - exposes the shared tracker for focused tests.

register(eventBus, client) and unregister(eventBus) are owned by PacketUtils runtime wiring. Ordinary SDK consumers should not register their own suite-level tracker.

Snapshot Types

All event snapshot types include client tick and wall-clock timestamp through the shared SdkEventSnapshot base.

  • XpGainedEvent - skill, previous XP, current XP, gained XP, real level, and boosted level.
  • InventoryDeltaEvent - container id, slot, item id, previous quantity, current quantity, and delta quantity.
  • NpcLifecycleEvent - spawn/despawn flag, NPC id, NPC index, name, world location, and local location.
  • AnimationChangeEvent - actor name, animation id, world location, and local location.
  • ProjectileMovementEvent - projectile id, source world point, target world point, target local point, target z, source actor name, and target actor name.

Ownership Detail

SdkEventTracker is the RuneLite event-bus subscriber behind SdkEvents. It records bounded recent snapshots with a default capacity of 128 per event kind. It is public for focused tests and explicit runtime ownership, but normal callers should consume the static SdkEvents facade.