Inverse findClueScroll conditions
For better readability, change the big if blocks in findClueScroll() method to early returns instead. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -436,17 +436,21 @@ public class ClueScrollPlugin extends Plugin
|
||||
|
||||
private ClueScroll findClueScroll()
|
||||
{
|
||||
Widget clueScrollText = client.getWidget(WidgetInfo.CLUE_SCROLL_TEXT);
|
||||
final Widget clueScrollText = client.getWidget(WidgetInfo.CLUE_SCROLL_TEXT);
|
||||
|
||||
if (clueScrollText != null)
|
||||
if (clueScrollText == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Remove line breaks and also the rare occasion where there are double line breaks
|
||||
String text = Text.removeTags(clueScrollText.getText()
|
||||
final String text = Text.removeTags(clueScrollText.getText()
|
||||
.replaceAll("-<br>", "-")
|
||||
.replaceAll("<br>", " ")
|
||||
.replaceAll("[ ]+", " ")
|
||||
.toLowerCase());
|
||||
|
||||
// Early return if this is same clue as already existing one
|
||||
if (clue instanceof TextClueScroll)
|
||||
{
|
||||
if (((TextClueScroll) clue).getText().equalsIgnoreCase(text))
|
||||
@@ -459,24 +463,25 @@ public class ClueScrollPlugin extends Plugin
|
||||
{
|
||||
return AnagramClue.forText(text);
|
||||
}
|
||||
else if (text.startsWith("the cipher reveals who to speak to next:"))
|
||||
|
||||
if (text.startsWith("the cipher reveals who to speak to next:"))
|
||||
{
|
||||
return CipherClue.forText(text);
|
||||
}
|
||||
else if (text.contains("degrees") && text.contains("minutes"))
|
||||
|
||||
if (text.contains("degrees") && text.contains("minutes"))
|
||||
{
|
||||
return coordinatesToWorldPoint(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
CrypticClue crypticClue = CrypticClue.forText(text);
|
||||
|
||||
final CrypticClue crypticClue = CrypticClue.forText(text);
|
||||
|
||||
if (crypticClue != null)
|
||||
{
|
||||
return crypticClue;
|
||||
}
|
||||
|
||||
EmoteClue emoteClue = EmoteClue.forText(text);
|
||||
final EmoteClue emoteClue = EmoteClue.forText(text);
|
||||
|
||||
if (emoteClue != null)
|
||||
{
|
||||
@@ -509,10 +514,6 @@ public class ClueScrollPlugin extends Plugin
|
||||
resetClue(true);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Example input: "00 degrees 00 minutes north 07 degrees 13 minutes west"
|
||||
|
||||
Reference in New Issue
Block a user