cluescroll: Combine nested if statements

This commit is contained in:
sdburns1998
2019-07-07 03:06:09 +02:00
parent e74faa9cdf
commit 706e9fbf13
2 changed files with 15 additions and 27 deletions

View File

@@ -78,14 +78,11 @@ public class ClueScrollOverlay extends Overlay
clue.makeOverlayHint(panelComponent, plugin); clue.makeOverlayHint(panelComponent, plugin);
if (clue.isRequiresSpade() && plugin.getInventoryItems() != null) if (clue.isRequiresSpade() && plugin.getInventoryItems() != null && !HAS_SPADE.fulfilledBy(plugin.getInventoryItems()))
{
if (!HAS_SPADE.fulfilledBy(plugin.getInventoryItems()))
{ {
panelComponent.getChildren().add(LineComponent.builder().left("").build()); panelComponent.getChildren().add(LineComponent.builder().left("").build());
panelComponent.getChildren().add(LineComponent.builder().left("Requires Spade!").leftColor(Color.RED).build()); panelComponent.getChildren().add(LineComponent.builder().left("Requires Spade!").leftColor(Color.RED).build());
} }
}
return panelComponent.render(graphics); return panelComponent.render(graphics);
} }

View File

@@ -211,13 +211,10 @@ public class ClueScrollPlugin extends Plugin
return; return;
} }
if (clue instanceof HotColdClue) if (clue instanceof HotColdClue && ((HotColdClue) clue).update(event.getMessage(), this))
{
if (((HotColdClue) clue).update(event.getMessage(), this))
{ {
worldMapPointsSet = false; worldMapPointsSet = false;
} }
}
if (!event.getMessage().equals("The strange device cools as you find your treasure.") if (!event.getMessage().equals("The strange device cools as you find your treasure.")
&& !event.getMessage().equals("Well done, you've completed the Treasure Trail!")) && !event.getMessage().equals("Well done, you've completed the Treasure Trail!"))
@@ -272,9 +269,7 @@ public class ClueScrollPlugin extends Plugin
} }
// if three step clue check for clue scroll pieces // if three step clue check for clue scroll pieces
if (clue instanceof ThreeStepCrypticClue) if (clue instanceof ThreeStepCrypticClue && ((ThreeStepCrypticClue) clue).update(client, event, itemManager))
{
if (((ThreeStepCrypticClue) clue).update(client, event, itemManager))
{ {
worldMapPointsSet = false; worldMapPointsSet = false;
npcsToMark.clear(); npcsToMark.clear();
@@ -287,7 +282,6 @@ public class ClueScrollPlugin extends Plugin
checkClueNPCs(clue, client.getCachedNPCs()); checkClueNPCs(clue, client.getCachedNPCs());
} }
} }
}
@Subscribe @Subscribe
public void onNpcSpawned(final NpcSpawned event) public void onNpcSpawned(final NpcSpawned event)
@@ -483,13 +477,10 @@ public class ClueScrollPlugin extends Plugin
final String text = Text.sanitizeMultilineText(clueScrollText.getText()).toLowerCase(); final String text = Text.sanitizeMultilineText(clueScrollText.getText()).toLowerCase();
// Early return if this is same clue as already existing one // Early return if this is same clue as already existing one
if (clue instanceof TextClueScroll) if (clue instanceof TextClueScroll && ((TextClueScroll) clue).getText().equalsIgnoreCase(text))
{
if (((TextClueScroll) clue).getText().equalsIgnoreCase(text))
{ {
return clue; return clue;
} }
}
// (This|The) anagram reveals who to speak to next: // (This|The) anagram reveals who to speak to next:
if (text.contains("anagram reveals who to speak to next:")) if (text.contains("anagram reveals who to speak to next:"))