From 075353427a81f2455e10367c6eb76031048826f2 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 9 Jun 2024 13:11:44 +0800 Subject: Add AbstractContainerMatcher --- .../skyblock/item/slottext/SlotTextAdder.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock/item/slottext') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/slottext/SlotTextAdder.java b/src/main/java/de/hysky/skyblocker/skyblock/item/slottext/SlotTextAdder.java index 7ffa5fba..6618cda1 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/slottext/SlotTextAdder.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/slottext/SlotTextAdder.java @@ -1,10 +1,9 @@ package de.hysky.skyblocker.skyblock.item.slottext; import de.hysky.skyblocker.config.SkyblockerConfigManager; -import de.hysky.skyblocker.skyblock.ChestValue; +import de.hysky.skyblocker.utils.render.gui.AbstractContainerMatcher; import net.minecraft.screen.slot.Slot; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.regex.Pattern; @@ -12,21 +11,14 @@ import java.util.regex.Pattern; /** * Extend this class and add it to {@link SlotTextManager#adders} to add text to any arbitrary slot. */ -public abstract class SlotTextAdder { - /** - * The title of the screen must match this pattern for this adder to be applied. Null means it will be applied to all screens. - * @implNote Don't end your regex with a {@code $} as {@link ChestValue} appends text to the end of the title, - * so the regex will stop matching if the player uses it. - */ - public final @Nullable Pattern titlePattern; - +public abstract class SlotTextAdder extends AbstractContainerMatcher { /** * Utility constructor that will compile the given string into a pattern. * * @see #SlotTextAdder(Pattern) */ protected SlotTextAdder(@NotNull String titlePattern) { - this(Pattern.compile(titlePattern)); + super(titlePattern); } /** @@ -35,14 +27,14 @@ public abstract class SlotTextAdder { * @param titlePattern The pattern to match the screen title against. */ protected SlotTextAdder(@NotNull Pattern titlePattern) { - this.titlePattern = titlePattern; + super(titlePattern); } /** * Creates a SlotTextAdder that will be applied to all screens. */ protected SlotTextAdder() { - this.titlePattern = null; + super(); } /** -- cgit