plugins: Use isDying for loot and boss timer checks

This commit is contained in:
Jordan Atwood
2022-06-21 15:29:01 -07:00
committed by Adam
parent 07d55b864e
commit 9da5852231
2 changed files with 9 additions and 3 deletions

View File

@@ -71,6 +71,7 @@ public class LootManager
private final EventBus eventBus;
private final Client client;
private final NpcUtil npcUtil;
private final ListMultimap<Integer, ItemStack> itemSpawns = ArrayListMultimap.create();
private final Set<LocalPoint> killPoints = new HashSet<>();
private WorldPoint playerLocationLastTick;
@@ -80,10 +81,11 @@ public class LootManager
private int delayedLootTickLimit;
@Inject
private LootManager(EventBus eventBus, Client client)
private LootManager(EventBus eventBus, Client client, NpcUtil npcUtil)
{
this.eventBus = eventBus;
this.client = client;
this.npcUtil = npcUtil;
eventBus.register(this);
}
@@ -98,7 +100,7 @@ public class LootManager
delayedLootTickLimit = 0;
}
if (!npc.isDead())
if (!npcUtil.isDying(npc))
{
int id = npc.getId();
switch (id)

View File

@@ -31,6 +31,7 @@ import net.runelite.api.NPC;
import net.runelite.api.events.NpcDespawned;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.NpcUtil;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@@ -49,6 +50,9 @@ public class BossTimersPlugin extends Plugin
@Inject
private ItemManager itemManager;
@Inject
private NpcUtil npcUtil;
@Override
protected void shutDown() throws Exception
{
@@ -60,7 +64,7 @@ public class BossTimersPlugin extends Plugin
{
NPC npc = npcDespawned.getNpc();
if (!npc.isDead())
if (!npcUtil.isDying(npc))
{
return;
}