Skip to content

Commit

Permalink
boss timers plugin: change to use npc despawn event
Browse files Browse the repository at this point in the history
Since e915070 it is possible to check hp in the despawn event.

This also fixes timer accuracy some since the timer starts at the time the npc despawns and not when the death animation starts.
  • Loading branch information
Adam- committed May 27, 2018
1 parent 7ad3120 commit a40181a
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import com.google.common.eventbus.Subscribe;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Actor;
import net.runelite.api.events.ActorDeath;
import net.runelite.api.NPC;
import net.runelite.api.events.NpcDespawned;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
Expand All @@ -54,9 +54,14 @@ protected void shutDown() throws Exception
}

@Subscribe
public void onActorDeath(ActorDeath death)
public void onNpcDespawned(NpcDespawned npcDespawned)
{
Actor actor = death.getActor();
NPC actor = npcDespawned.getNpc();

if (actor.getHealthRatio() != 0)
{
return;
}

Boss boss = Boss.find(actor.getName());
if (boss == null)
Expand Down

0 comments on commit a40181a

Please sign in to comment.