diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-03-19 09:54:19 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-03-19 09:54:19 +0100 |
commit | 68d54cef1cf410c51d026d22228de9b3e4a274fa (patch) | |
tree | edff2c9a17e7dbb2b52c1d97c6de8deaa72aef40 /src/main | |
parent | 27e909463ea5c2553c7ac89eb350e70627aa8fc9 (diff) | |
download | skyhanni-68d54cef1cf410c51d026d22228de9b3e4a274fa.tar.gz skyhanni-68d54cef1cf410c51d026d22228de9b3e4a274fa.tar.bz2 skyhanni-68d54cef1cf410c51d026d22228de9b3e4a274fa.zip |
code cleanup
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt index 00f57b519..20dde4bcf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt @@ -21,6 +21,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +// TODO Remove all removeColor calls in this class. Deal with the color code in regex. class DungeonFinderFeatures { private val config get() = SkyHanniMod.feature.dungeon.partyFinder @@ -145,6 +146,7 @@ class DungeonFinderFeatures { val name = stack.displayName.removeColor() map[slot] = if (anyFloorPattern.matches(name)) { "A" + } else if (entranceFloorPattern.matches(name)) { "E" } else if (floorPattern.matches(name)) { @@ -166,13 +168,8 @@ class DungeonFinderFeatures { val floorNum = floorNumberPattern.matchMatcher(floor) { group("floorNum").romanToDecimalIfNecessary() } - map[slot] = if (entranceFloorPattern.matches(floor)) { - "E" - } else if (masterModeFloorPattern.matches(dungeon)) { - "M$floorNum" - } else { - "F$floorNum" - } + + map[slot] = getFloorName(floor, dungeon, floorNum) } } @@ -194,17 +191,20 @@ class DungeonFinderFeatures { val floorNum = floorNumberPattern.matchMatcher(name) { group("floorNum").romanToDecimalIfNecessary() } ?: continue - map[slot] = if (entranceFloorPattern.matches(name)) { - "E" - } else if (masterModeFloorPattern.matches(name)) { - "M$floorNum" - } else { - "F$floorNum" - } + map[slot] = getFloorName(name, name, floorNum) } } + private fun getFloorName(floor: String, dungeon: String, floorNum: Int?): String = + if (entranceFloorPattern.matches(floor)) { + "E" + } else if (masterModeFloorPattern.matches(dungeon)) { + "M$floorNum" + } else { + "F$floorNum" + } + private fun highlightingHandler(event: InventoryOpenEvent): Map<Int, LorenzColor> { val map = mutableMapOf<Int, LorenzColor>() if (!partyFinderTitlePattern.matches(event.inventoryName)) return map |