clues: Don't return clue instances for empty text
This commit ensures that all clues providing a static `forText()` method return null when given an empty string as clue text.
This commit is contained in:
@@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.ObjectID;
|
||||
@@ -171,16 +172,18 @@ public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
||||
private final String npc;
|
||||
private final WorldPoint location;
|
||||
private final String area;
|
||||
@Nullable
|
||||
private final String question;
|
||||
@Nullable
|
||||
private final String answer;
|
||||
private int objectId;
|
||||
|
||||
private AnagramClue(String text, String npc, WorldPoint location, String area)
|
||||
{
|
||||
this(text, npc, location, area, "", null);
|
||||
this(text, npc, location, area, null, null);
|
||||
}
|
||||
|
||||
private AnagramClue(String text, String npc, WorldPoint location, String area, String question, String answer)
|
||||
private AnagramClue(String text, String npc, WorldPoint location, String area, @Nullable String question, @Nullable String answer)
|
||||
{
|
||||
this.text = text;
|
||||
this.npc = npc;
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
@@ -64,15 +65,17 @@ public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScr
|
||||
private String npc;
|
||||
private WorldPoint location;
|
||||
private String area;
|
||||
@Nullable
|
||||
private String question;
|
||||
@Nullable
|
||||
private String answer;
|
||||
|
||||
private CipherClue(String text, String npc, WorldPoint location, String area)
|
||||
{
|
||||
this(text, npc, location, area, "", null);
|
||||
this(text, npc, location, area, null, null);
|
||||
}
|
||||
|
||||
private CipherClue(String text, String npc, WorldPoint location, String area, String question, String answer)
|
||||
private CipherClue(String text, String npc, WorldPoint location, String area, @Nullable String question, @Nullable String answer)
|
||||
{
|
||||
this.text = "The cipher reveals who to speak to next: " + text;
|
||||
this.npc = npc;
|
||||
@@ -129,7 +132,7 @@ public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScr
|
||||
{
|
||||
for (CipherClue clue : CLUES)
|
||||
{
|
||||
if (clue.text.equalsIgnoreCase(text) || clue.question.equalsIgnoreCase(text))
|
||||
if (text.equalsIgnoreCase(clue.text) || text.equalsIgnoreCase(clue.question))
|
||||
{
|
||||
return clue;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.NPC;
|
||||
import static net.runelite.api.NullObjectID.NULL_1293;
|
||||
@@ -331,6 +332,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
||||
private final int objectId;
|
||||
private final WorldPoint location;
|
||||
private final String solution;
|
||||
@Nullable
|
||||
private final String questionText;
|
||||
|
||||
private CrypticClue(String text, WorldPoint location, String solution)
|
||||
@@ -340,12 +342,12 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
||||
|
||||
private CrypticClue(String text, int objectId, WorldPoint location, String solution)
|
||||
{
|
||||
this(text, null, objectId, location, solution, "");
|
||||
this(text, null, objectId, location, solution, null);
|
||||
}
|
||||
|
||||
private CrypticClue(String text, String npc, WorldPoint location, String solution)
|
||||
{
|
||||
this(text, npc, -1, location, solution, "");
|
||||
this(text, npc, -1, location, solution, null);
|
||||
}
|
||||
|
||||
private CrypticClue(String text, String npc, WorldPoint location, String solution, boolean requiresLight)
|
||||
@@ -366,10 +368,10 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
||||
|
||||
private CrypticClue(String text, String npc, int objectId, WorldPoint location, String solution)
|
||||
{
|
||||
this(text, npc, objectId, location, solution, "");
|
||||
this(text, npc, objectId, location, solution, null);
|
||||
}
|
||||
|
||||
private CrypticClue(String text, String npc, int objectId, WorldPoint location, String solution, String questionText)
|
||||
private CrypticClue(String text, String npc, int objectId, WorldPoint location, String solution, @Nullable String questionText)
|
||||
{
|
||||
this.text = text;
|
||||
this.npc = npc;
|
||||
@@ -465,7 +467,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
||||
{
|
||||
for (CrypticClue clue : CLUES)
|
||||
{
|
||||
if (clue.text.equalsIgnoreCase(text) || clue.questionText.equalsIgnoreCase(text))
|
||||
if (text.equalsIgnoreCase(clue.text) || text.equalsIgnoreCase(clue.questionText))
|
||||
{
|
||||
return clue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user