diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-23 20:40:58 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-23 20:40:58 +0200 |
commit | 531506dcf7b61e2dea50e14bfe32e9547f7997be (patch) | |
tree | 8e13a16bbf23f03d02ae6ec0ae4edcb2a4624791 /src | |
parent | ca5374842862e8f7258bb8d4ff9dc42b623cac6d (diff) | |
download | skyhanni-531506dcf7b61e2dea50e14bfe32e9547f7997be.tar.gz skyhanni-531506dcf7b61e2dea50e14bfe32e9547f7997be.tar.bz2 skyhanni-531506dcf7b61e2dea50e14bfe32e9547f7997be.zip |
code cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 4 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillarTimer.kt) | 32 |
2 files changed, 16 insertions, 20 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 2805354b4..da0e6ca78 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -33,7 +33,7 @@ import at.hannibal2.skyhanni.features.slayer.EndermanSlayerBeacon; import at.hannibal2.skyhanni.features.slayer.HideMobNames; import at.hannibal2.skyhanni.features.slayer.HighlightSlayerMiniboss; import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerDaggerHelper; -import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerPillarTimer; +import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerPillar; import at.hannibal2.skyhanni.features.summonings.SummoningMobManager; import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName; import at.hannibal2.skyhanni.test.LorenzTest; @@ -133,7 +133,7 @@ public class SkyHanniMod { registerEvent(new HideMobNames()); registerEvent(new HideDamageSplash()); registerEvent(new ThunderSparksHighlight()); - registerEvent(new BlazeSlayerPillarTimer()); + registerEvent(new BlazeSlayerPillar()); registerEvent(new BlazeSlayerDaggerHelper()); registerEvent(new PlayerChatFilter()); registerEvent(new HideArmor()); diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillarTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt index b75da2cc5..2612f8aa8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillarTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerPillar.kt @@ -16,15 +16,11 @@ import net.minecraftforge.fml.common.gameevent.TickEvent import java.text.DecimalFormat import java.util.regex.Pattern -class BlazeSlayerPillarTimer { +class BlazeSlayerPillar { - private var pattern = Pattern.compile("§cYou took §r§f(.+) §r§ctrue damage from an exploding fire pillar!") - - private var lastFound = -1L - - private val pillarTimerEntities = mutableListOf<EntityArmorStand>() - - var tick = 0 + private var patternPillarExploded = Pattern.compile("§cYou took §r§f(.+) §r§ctrue damage from an exploding fire pillar!") + private var lastPillarSpawnTime = -1L + private val pillarEntities = mutableListOf<EntityArmorStand>() @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { @@ -32,9 +28,9 @@ class BlazeSlayerPillarTimer { for (armorStand in Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityArmorStand>()) { val name = armorStand.name if (name.matchRegex("§6§l.s §c§l8 hits")) { - if (armorStand !in pillarTimerEntities) { - pillarTimerEntities.add(armorStand) - lastFound = System.currentTimeMillis() + if (armorStand !in pillarEntities) { + pillarEntities.add(armorStand) + lastPillarSpawnTime = System.currentTimeMillis() } } } @@ -45,25 +41,25 @@ class BlazeSlayerPillarTimer { if (!isEnabled()) return val message = event.message - val matcher = pattern.matcher(message) + val matcher = patternPillarExploded.matcher(message) if (matcher.matches()) { - lastFound = -1L + lastPillarSpawnTime = -1L } if (message == " §r§a§lSLAYER QUEST COMPLETE!") { - lastFound = -1L + lastPillarSpawnTime = -1L } if (message == "§eYour Slayer boss was despawned, but you have kept your quest progress!") { - lastFound = -1L + lastPillarSpawnTime = -1L } } @SubscribeEvent fun renderOverlay(event: RenderGameOverlayEvent.Post) { if (!isEnabled()) return - if (lastFound == -1L) return + if (lastPillarSpawnTime == -1L) return - val duration = System.currentTimeMillis() - lastFound + val duration = System.currentTimeMillis() - lastPillarSpawnTime val maxDuration = 7_000 val remainingLong = maxDuration - duration @@ -80,6 +76,6 @@ class BlazeSlayerPillarTimer { @SubscribeEvent fun onWorldChange(event: WorldEvent.Load) { - pillarTimerEntities.clear() + pillarEntities.clear() } }
\ No newline at end of file |