From 4f4838404ad1aa90d35d3059f1d012c0cd7c9a07 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 16 Apr 2023 20:16:20 +0200 Subject: Using more regex --- .../features/garden/inventory/GardenTeleportPadInventoryNumber.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenTeleportPadInventoryNumber.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenTeleportPadInventoryNumber.kt index 757e03a62..dcb018404 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenTeleportPadInventoryNumber.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenTeleportPadInventoryNumber.kt @@ -57,10 +57,12 @@ class GardenTeleportPadInventoryNumber { } private var inTeleportPad = false + private val pattern = "§.(.*) teleport pad".toPattern() @SubscribeEvent fun onInventoryOpen(event: InventoryOpenEvent) { - inTeleportPad = event.inventoryName == "Set Destination" && SkyHanniMod.feature.garden.teleportPadsInventoryNumbers + inTeleportPad = + event.inventoryName == "Set Destination" && SkyHanniMod.feature.garden.teleportPadsInventoryNumbers } @SubscribeEvent @@ -69,12 +71,10 @@ class GardenTeleportPadInventoryNumber { if (!inTeleportPad) return val name = event.stack.name?.lowercase() ?: return - val pattern = "§.(.*) teleport pad".toPattern() - val matcher = pattern.matcher(name) if (!matcher.matches()) return - val text = matcher.group(1) + val text = matcher.group(1) numbers[text]?.let { event.stackTip = "$it" return -- cgit