zulrah: Fix NPE (#1209)
* zulrah: Fix NPE * Add nullable tags to phases.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
package net.runelite.client.plugins.zulrah;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Prayer;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
@@ -101,6 +102,7 @@ public class ZulrahInstance
|
||||
stage = 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ZulrahPhase getPhase()
|
||||
{
|
||||
ZulrahPhase patternPhase = null;
|
||||
@@ -116,6 +118,7 @@ public class ZulrahInstance
|
||||
this.phase = phase;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ZulrahPhase getNextPhase()
|
||||
{
|
||||
if (pattern != null)
|
||||
|
||||
@@ -217,28 +217,32 @@ public class ZulrahPlugin extends Plugin
|
||||
}
|
||||
|
||||
ZulrahPhase currentPhase = instance.getPhase();
|
||||
ZulrahPhase nextPhase = instance.getNextPhase();
|
||||
|
||||
if (currentPhase == null)
|
||||
if (currentPhase == null || nextPhase == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Actor actor = event.getActor();
|
||||
final Actor actor = event.getActor();
|
||||
|
||||
if (config.sounds() && zulrah != null && zulrah.equals(actor) && zulrah.getAnimation() == AnimationID.ZULRAH_PHASE)
|
||||
{
|
||||
Prayer prayer = instance.getNextPhase().getPrayer();
|
||||
Prayer prayer = nextPhase.getPrayer();
|
||||
|
||||
if (prayer != null)
|
||||
if (prayer == null)
|
||||
{
|
||||
switch (prayer)
|
||||
{
|
||||
case PROTECT_FROM_MAGIC:
|
||||
soundManager.playSound(Sound.PRAY_MAGIC);
|
||||
break;
|
||||
case PROTECT_FROM_MISSILES:
|
||||
soundManager.playSound(Sound.PRAY_RANGED);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
switch (prayer)
|
||||
{
|
||||
case PROTECT_FROM_MAGIC:
|
||||
soundManager.playSound(Sound.PRAY_MAGIC);
|
||||
break;
|
||||
case PROTECT_FROM_MISSILES:
|
||||
soundManager.playSound(Sound.PRAY_RANGED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user