Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make TerminalSolver interface & ExperimentSolver class sealed #722

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.*;


public class ColorTerminal extends ContainerSolver implements TerminalSolver {
public final class ColorTerminal extends ContainerSolver implements TerminalSolver {
private static final Logger LOGGER = LoggerFactory.getLogger(ColorTerminal.class.getName());
private static final Map<String, DyeColor> colorFromName;
private DyeColor targetColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* This doesn't solve the terminal because you don't need a solver for it, but rather to simply allow for click blocking.
*/
public class LightsOnTerminal extends ContainerSolver implements TerminalSolver {
public final class LightsOnTerminal extends ContainerSolver implements TerminalSolver {
private static final List<ColorHighlight> EMPTY = List.of();

public LightsOnTerminal() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.Collections;
import java.util.List;

public class OrderTerminal extends ContainerSolver implements TerminalSolver {
public final class OrderTerminal extends ContainerSolver implements TerminalSolver {
private final int PANES_NUM = 14;
private int[] orderedSlots;
private int currentNum = Integer.MAX_VALUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.List;
import java.util.function.Predicate;

public class StartsWithTerminal extends ContainerSolver implements TerminalSolver {
public final class StartsWithTerminal extends ContainerSolver implements TerminalSolver {
private final Int2ObjectOpenHashMap<ItemState> trackedItemStates = new Int2ObjectOpenHashMap<>();
private int lastKnownScreenId = Integer.MIN_VALUE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import de.hysky.skyblocker.config.SkyblockerConfigManager;

public interface TerminalSolver {
public sealed interface TerminalSolver permits ColorTerminal, LightsOnTerminal, OrderTerminal, StartsWithTerminal {

default boolean shouldBlockIncorrectClicks() {
return SkyblockerConfigManager.get().dungeons.terminals.blockIncorrectClicks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.google.common.collect.ImmutableMap;

import de.hysky.skyblocker.config.SkyblockerConfig;
import de.hysky.skyblocker.config.configs.HelperConfig;
import de.hysky.skyblocker.utils.render.gui.ColorHighlight;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
Expand All @@ -17,7 +16,7 @@
import java.util.ArrayList;
import java.util.List;

public class ChronomatronSolver extends ExperimentSolver {
public final class ChronomatronSolver extends ExperimentSolver {
public static final ImmutableMap<Item, Item> TERRACOTTA_TO_GLASS = ImmutableMap.ofEntries(
new AbstractMap.SimpleImmutableEntry<>(Items.RED_TERRACOTTA, Items.RED_STAINED_GLASS),
new AbstractMap.SimpleImmutableEntry<>(Items.ORANGE_TERRACOTTA, Items.ORANGE_STAINED_GLASS),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.HashMap;
import java.util.Map;

public abstract class ExperimentSolver extends ContainerSolver {
public sealed abstract class ExperimentSolver extends ContainerSolver permits ChronomatronSolver, SuperpairsSolver, UltrasequencerSolver {
public enum State {
REMEMBER, WAIT, SHOW, END
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.hysky.skyblocker.skyblock.experiment;

import de.hysky.skyblocker.config.SkyblockerConfig;
import de.hysky.skyblocker.config.configs.HelperConfig;
import de.hysky.skyblocker.utils.render.gui.ColorHighlight;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
Expand All @@ -11,7 +10,7 @@

import java.util.*;

public class SuperpairsSolver extends ExperimentSolver {
public final class SuperpairsSolver extends ExperimentSolver {
private int superpairsPrevClickedSlot;
private ItemStack superpairsCurrentSlot;
private final Set<Integer> superpairsDuplicatedSlots = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.hysky.skyblocker.skyblock.experiment;

import de.hysky.skyblocker.config.SkyblockerConfig;
import de.hysky.skyblocker.config.configs.HelperConfig;
import de.hysky.skyblocker.utils.render.gui.ColorHighlight;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
Expand All @@ -12,7 +11,7 @@
import java.util.ArrayList;
import java.util.List;

public class UltrasequencerSolver extends ExperimentSolver {
public final class UltrasequencerSolver extends ExperimentSolver {
public static final UltrasequencerSolver INSTANCE = new UltrasequencerSolver();
private int ultrasequencerNextSlot;

Expand Down