From ee9f88fbdec458534e23b6c3e58d5e8e7c24c80d Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 16 Nov 2024 17:41:42 +0100 Subject: [PATCH] tiny code polish --- .../quests/thecurseofarrav/MetalDoorSolver.java | 2 -- .../quests/thecurseofarrav/TheCurseOfArrav.java | 4 ---- .../quests/thecurseofarrav/TilePuzzleSolver.java | 11 ----------- .../thecurseofarrav/rubblesolvers/RubbleSolver.java | 12 ++++-------- .../rubblesolvers/RubbleSolverOne.java | 12 ------------ .../thecurseofarrav/rubblesolvers/RubbleType.java | 8 +++----- 6 files changed, 7 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/MetalDoorSolver.java b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/MetalDoorSolver.java index 052f020ee4..c3954f5dba 100644 --- a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/MetalDoorSolver.java +++ b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/MetalDoorSolver.java @@ -2,7 +2,6 @@ import com.questhelper.QuestHelperPlugin; import com.questhelper.requirements.ManualRequirement; -import com.questhelper.requirements.Requirement; import com.questhelper.requirements.item.ItemRequirement; import com.questhelper.requirements.widget.WidgetModelRequirement; import com.questhelper.requirements.widget.WidgetPresenceRequirement; @@ -14,7 +13,6 @@ import com.questhelper.steps.ObjectStep; import com.questhelper.steps.QuestStep; import java.awt.*; -import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.regex.Pattern; diff --git a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/TheCurseOfArrav.java b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/TheCurseOfArrav.java index fb7fe31440..7ceb1168f7 100644 --- a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/TheCurseOfArrav.java +++ b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/TheCurseOfArrav.java @@ -35,17 +35,14 @@ import com.questhelper.questinfo.QuestHelperQuest; import com.questhelper.requirements.Requirement; import com.questhelper.requirements.item.ItemRequirement; -import com.questhelper.requirements.item.ItemRequirements; import com.questhelper.requirements.item.TeleportItemRequirement; import com.questhelper.requirements.player.CombatLevelRequirement; import com.questhelper.requirements.player.FreeInventorySlotRequirement; import com.questhelper.requirements.player.SkillRequirement; import com.questhelper.requirements.quest.QuestRequirement; import static com.questhelper.requirements.util.LogicHelper.and; -import static com.questhelper.requirements.util.LogicHelper.nor; import static com.questhelper.requirements.util.LogicHelper.not; import static com.questhelper.requirements.util.LogicHelper.or; -import com.questhelper.requirements.util.Operation; import com.questhelper.requirements.var.VarbitRequirement; import com.questhelper.requirements.zone.Zone; import com.questhelper.requirements.zone.ZoneRequirement; @@ -582,7 +579,6 @@ public void setupSteps() var inSecondPart = new ZoneRequirement(new Zone(new WorldPoint(3590, 4538, 0), new WorldPoint(3622, 4597, 0))); var inStorageRoom = new ZoneRequirement(new Zone(new WorldPoint(3614, 4571, 0), new WorldPoint(3605, 4563, 0))); - var decoderStrips = new ItemRequirement("Decoder strips", ItemID.DECODER_STRIPS); searchTableForDecoderStrips = new ObjectStep(this, ObjectID.TABLE_50533, "Search the table for some decoder strips."); enterStorageRoom = new ObjectStep(this, ObjectID.GATE_50537, new WorldPoint(3609, 4572, 0), "Enter the storage room to the south-east."); var exitStorageRoom = new ObjectStep(this, ObjectID.GATE_50537, new WorldPoint(3609, 4572, 0), "Exit the storage room."); diff --git a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/TilePuzzleSolver.java b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/TilePuzzleSolver.java index 2d799b7364..9edc133148 100644 --- a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/TilePuzzleSolver.java +++ b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/TilePuzzleSolver.java @@ -255,16 +255,6 @@ public void onGameTick(GameTick event) this.shortestPath = possiblePath; } } - - if (this.shortestPath == null) - { - // TODO: tell user to just find a way to solve it lol - } - else - { - // TODO: figure out how to highlight this? make object steps? - // How do I get the correct world points? maybe check objectstep to see if we offset it somewhere with instance points or something - } } updateSteps(); @@ -359,7 +349,6 @@ protected void updateSteps() { log.debug("user stepped off the path, lead them back"); startUpStep(this.mostRecentStep); - return; } } else { log.debug("player is outside of puzzle: {} / {} / {}/{}", playerWp, localPoint, xInPuzzle, yInPuzzle); diff --git a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleSolver.java b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleSolver.java index 69e845c12e..7c721db57c 100644 --- a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleSolver.java +++ b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleSolver.java @@ -27,9 +27,10 @@ public abstract class RubbleSolver extends DetailedOwnerStep { private List inverseConditions; private ConditionalStep conditionalStep; - private int stepCounter; + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private int stepCounter; - public RubbleSolver(TheCurseOfArrav theCurseOfArrav, String number) { + public RubbleSolver(TheCurseOfArrav theCurseOfArrav, @SuppressWarnings("unused") String number) { super(theCurseOfArrav, "Make your way through the Trollweiss cave, mining rubble with your pickaxe from the direction indicated. Rubble can only be mined from the same direction once."); } @@ -115,9 +116,6 @@ protected void setupSteps() { // Useful for debugging // mineStep.addRequirement(inverseCondition); - // var xd = new Conditions(LogicType.AND, inverseCondition); - // xd.setText(inverseCondition.getDisplayText()); - conditionalStep.addStep(inverseCondition, mineStep); } } @@ -131,9 +129,7 @@ public List getSteps() { var steps = new ArrayList(); steps.add(this.conditionalStep); - for (var step : this.mineSteps) { - steps.add(step); - } + steps.addAll(this.mineSteps); return steps; } diff --git a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleSolverOne.java b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleSolverOne.java index 5ea75dda5e..56033e0884 100644 --- a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleSolverOne.java +++ b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleSolverOne.java @@ -1,21 +1,9 @@ package com.questhelper.helpers.quests.thecurseofarrav.rubblesolvers; import com.questhelper.helpers.quests.thecurseofarrav.TheCurseOfArrav; -import com.questhelper.requirements.Requirement; -import com.questhelper.requirements.conditional.Conditions; -import com.questhelper.requirements.conditional.ObjectCondition; -import com.questhelper.requirements.util.LogicType; -import com.questhelper.steps.*; -import java.util.*; - -import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import net.runelite.api.*; import net.runelite.api.coords.Direction; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameTick; -import net.runelite.client.eventbus.Subscribe; /** * This class describes the rubble mining steps required for Roadblock 1 (when quest state varbit is 22) diff --git a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleType.java b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleType.java index 6715b77c19..ee92da77a4 100644 --- a/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleType.java +++ b/src/main/java/com/questhelper/helpers/quests/thecurseofarrav/rubblesolvers/RubbleType.java @@ -3,6 +3,7 @@ import lombok.Getter; import net.runelite.api.ObjectID; import java.util.ArrayList; +import java.util.Collections; import java.util.List; @Getter @@ -15,10 +16,7 @@ public enum RubbleType private final List objectIDs; RubbleType(Integer... possibleObjectIDs) { - this.objectIDs = new ArrayList(); - for (var xd : possibleObjectIDs) { - this.objectIDs.add(xd); - } - // Collections.addAll(this.objectIDs, possibleObjectIDs); + this.objectIDs = new ArrayList<>(); + Collections.addAll(this.objectIDs, possibleObjectIDs); } }