plugins: Use isDying for loot and boss timer checks
This commit is contained in:
@@ -71,6 +71,7 @@ public class LootManager
|
|||||||
|
|
||||||
private final EventBus eventBus;
|
private final EventBus eventBus;
|
||||||
private final Client client;
|
private final Client client;
|
||||||
|
private final NpcUtil npcUtil;
|
||||||
private final ListMultimap<Integer, ItemStack> itemSpawns = ArrayListMultimap.create();
|
private final ListMultimap<Integer, ItemStack> itemSpawns = ArrayListMultimap.create();
|
||||||
private final Set<LocalPoint> killPoints = new HashSet<>();
|
private final Set<LocalPoint> killPoints = new HashSet<>();
|
||||||
private WorldPoint playerLocationLastTick;
|
private WorldPoint playerLocationLastTick;
|
||||||
@@ -80,10 +81,11 @@ public class LootManager
|
|||||||
private int delayedLootTickLimit;
|
private int delayedLootTickLimit;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private LootManager(EventBus eventBus, Client client)
|
private LootManager(EventBus eventBus, Client client, NpcUtil npcUtil)
|
||||||
{
|
{
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
|
this.npcUtil = npcUtil;
|
||||||
eventBus.register(this);
|
eventBus.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +100,7 @@ public class LootManager
|
|||||||
delayedLootTickLimit = 0;
|
delayedLootTickLimit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!npc.isDead())
|
if (!npcUtil.isDying(npc))
|
||||||
{
|
{
|
||||||
int id = npc.getId();
|
int id = npc.getId();
|
||||||
switch (id)
|
switch (id)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import net.runelite.api.NPC;
|
|||||||
import net.runelite.api.events.NpcDespawned;
|
import net.runelite.api.events.NpcDespawned;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
|
import net.runelite.client.game.NpcUtil;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
@@ -49,6 +50,9 @@ public class BossTimersPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private ItemManager itemManager;
|
private ItemManager itemManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private NpcUtil npcUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown() throws Exception
|
protected void shutDown() throws Exception
|
||||||
{
|
{
|
||||||
@@ -60,7 +64,7 @@ public class BossTimersPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
NPC npc = npcDespawned.getNpc();
|
NPC npc = npcDespawned.getNpc();
|
||||||
|
|
||||||
if (!npc.isDead())
|
if (!npcUtil.isDying(npc))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user