diff options
author | Walker Selby <git@walkerselby.com> | 2023-09-29 11:30:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-29 20:30:27 +0200 |
commit | 343d5d9cea12beaf7a8dfabda2f61ad940be592a (patch) | |
tree | ceb0a82790eaa1a1babfe4a2e05220378037a748 /src/main/java/at/hannibal2/skyhanni/features/dungeon | |
parent | b364b6da62668ea44dfc23180fe70c13ec707804 (diff) | |
download | skyhanni-343d5d9cea12beaf7a8dfabda2f61ad940be592a.tar.gz skyhanni-343d5d9cea12beaf7a8dfabda2f61ad940be592a.tar.bz2 skyhanni-343d5d9cea12beaf7a8dfabda2f61ad940be592a.zip |
Random Code Cleanup (#516)
Sonar Lint for the win #516
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/dungeon')
6 files changed, 45 insertions, 90 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt index 739dbe17b..36ab4e3d8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt @@ -55,11 +55,10 @@ class DungeonAPI { if (!inDungeon()) return val message = rawMessage.removeColor() val bossName = message.substringAfter("[BOSS] ").substringBefore(":").trim() - if (bossName != "The Watcher" && dungeonFloor != null && checkBossName(dungeonFloor!!, bossName)) { - if (!inBossRoom) { + if (bossName != "The Watcher" && dungeonFloor != null && checkBossName(dungeonFloor!!, bossName) && + !inBossRoom) { DungeonBossRoomEnterEvent().postAndCatch() inBossRoom = true - } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt index ff29e4774..6d0afd651 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -83,27 +83,16 @@ class DungeonCleanEnd { if (entity == Minecraft.getMinecraft().thePlayer) return - if (SkyHanniMod.feature.dungeon.cleanEndF3IgnoreGuardians) { - if (DungeonAPI.isOneOf("F3", "M3")) { - if (entity is EntityGuardian) { - if (entity.entityId != lastBossId) { - if (Minecraft.getMinecraft().thePlayer.isSneaking) { - return - } - } - } - } + if (SkyHanniMod.feature.dungeon.cleanEndF3IgnoreGuardians + && DungeonAPI.isOneOf("F3", "M3") + && entity is EntityGuardian + && entity.entityId != lastBossId + && Minecraft.getMinecraft().thePlayer.isSneaking) { + return } - if (chestsSpawned) { - if (entity is EntityArmorStand) { - if (!entity.hasCustomName()) { - return - } - } - if (entity is EntityOtherPlayerMP) { - return - } + if (chestsSpawned && ((entity is EntityArmorStand && !entity.hasCustomName()) || entity is EntityOtherPlayerMP)) { + return } event.isCanceled = true @@ -118,10 +107,8 @@ class DungeonCleanEnd { @SubscribeEvent fun onPlaySound(event: PlaySoundEvent) { - if (shouldBlock() && !chestsSpawned) { - if (event.soundName.startsWith("note.")) { - event.isCanceled = true - } + if (shouldBlock() && !chestsSpawned && event.soundName.startsWith("note.")) { + event.isCanceled = true } } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt index e91c40ef8..1428a120a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -46,10 +46,8 @@ class DungeonHideItems { private fun isSkeletonSkull(entity: EntityArmorStand): Boolean { val itemStack = entity.inventory[4] - if (itemStack != null) { - if (itemStack.cleanName() == "Skeleton Skull") { - return true - } + if (itemStack != null && itemStack.cleanName() == "Skeleton Skull") { + return true } return false @@ -63,16 +61,12 @@ class DungeonHideItems { if (entity is EntityItem) { val stack = entity.entityItem - if (SkyHanniMod.feature.dungeon.hideReviveStone) { - if (stack.cleanName() == "Revive Stone") { - event.isCanceled = true - } + if (SkyHanniMod.feature.dungeon.hideReviveStone && stack.cleanName() == "Revive Stone") { + event.isCanceled = true } - if (SkyHanniMod.feature.dungeon.hideJournalEntry) { - if (stack.cleanName() == "Journal Entry") { - event.isCanceled = true - } + if (SkyHanniMod.feature.dungeon.hideJournalEntry && stack.cleanName() == "Journal Entry") { + event.isCanceled = true } } @@ -84,11 +78,9 @@ class DungeonHideItems { } val itemStack = entity.inventory[4] - if (itemStack != null) { - if (itemStack.cleanName() == "Superboom TNT") { - event.isCanceled = true - hideParticles[entity] = System.currentTimeMillis() - } + if (itemStack != null && itemStack.cleanName() == "Superboom TNT") { + event.isCanceled = true + hideParticles[entity] = System.currentTimeMillis() } } @@ -98,10 +90,8 @@ class DungeonHideItems { } val itemStack = entity.inventory[4] - if (itemStack != null) { - if (itemStack.getSkullTexture() == blessingTexture) { - event.isCanceled = true - } + if (itemStack != null && itemStack.getSkullTexture() == blessingTexture) { + event.isCanceled = true } } @@ -111,11 +101,9 @@ class DungeonHideItems { } val itemStack = entity.inventory[4] - if (itemStack != null) { - if (itemStack.getSkullTexture() == reviveStoneTexture) { - event.isCanceled = true - hideParticles[entity] = System.currentTimeMillis() - } + if (itemStack != null && itemStack.getSkullTexture() == reviveStoneTexture) { + event.isCanceled = true + hideParticles[entity] = System.currentTimeMillis() } } @@ -126,10 +114,8 @@ class DungeonHideItems { } val itemStack = entity.inventory[4] - if (itemStack != null) { - if (itemStack.getSkullTexture() == premiumFleshTexture) { - event.isCanceled = true - } + if (itemStack != null && itemStack.getSkullTexture() == premiumFleshTexture) { + event.isCanceled = true } } @@ -168,11 +154,9 @@ class DungeonHideItems { if (SkyHanniMod.feature.dungeon.hideHealerFairy) { val itemStack = entity.inventory[0] - if (itemStack != null) { - if (itemStack.getSkullTexture() == healerFairyTexture) { - event.isCanceled = true - return - } + if (itemStack != null && itemStack.getSkullTexture() == healerFairyTexture) { + event.isCanceled = true + return } } } @@ -213,12 +197,10 @@ class DungeonHideItems { if (!LorenzUtils.inDungeons) return if (!SkyHanniMod.feature.dungeon.highlightSkeletonSkull) return val entity = event.entity - if (entity is EntityArmorStand) { - if (isSkeletonSkull(entity)) { - val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) - if (lastMove + 200 > System.currentTimeMillis()) { - event.color = LorenzColor.GOLD.toColor().withAlpha(60) - } + if (entity is EntityArmorStand && isSkeletonSkull(entity)) { + val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) + if (lastMove + 200 > System.currentTimeMillis()) { + event.color = LorenzColor.GOLD.toColor().withAlpha(60) } } } @@ -228,12 +210,10 @@ class DungeonHideItems { if (!LorenzUtils.inDungeons) return if (!SkyHanniMod.feature.dungeon.highlightSkeletonSkull) return val entity = event.entity - if (entity is EntityArmorStand) { - if (isSkeletonSkull(entity)) { - val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) - if (lastMove + 200 > System.currentTimeMillis()) { - event.shouldReset = true - } + if (entity is EntityArmorStand && isSkeletonSkull(entity)) { + val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) + if (lastMove + 200 > System.currentTimeMillis()) { + event.shouldReset = true } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt index 02f9dd2fb..11b36e454 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt @@ -92,10 +92,4 @@ class DungeonHighlightClickedBlocks { CHEST("Chest"), WITHER_ESSENCE("Wither Essence"), } - -// private fun nearWaterRoom(): Boolean { -// val playerLoc = -// LocationUtils.getPlayerLocation().add(LocationUtils.getPlayerLookingAtDirection().multiply(2)).add(0, 2, 0) -// return WaterBoardSolver.waterRoomDisplays.any { it.distance(playerLoc) < 3 } -// } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt index 5797c0935..53d701b0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt @@ -37,11 +37,8 @@ class DungeonMilestonesDisplay { } private fun checkVisibility() { - if (currentMilestone >= 3) { - if (System.currentTimeMillis() > timeReached + 3_000) - if (display != "") { - display = display.substring(1) - } + if (currentMilestone >= 3 && System.currentTimeMillis() > timeReached + 3_000 && display != "") { + display = display.substring(1) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt index 27493abc4..c7d8293af 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt @@ -19,12 +19,10 @@ class HighlightDungeonDeathmite { val entity = event.entity val maxHealth = event.maxHealth - if (entity is EntitySilverfish) { - if (maxHealth == 1_000_000_000) { - RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_RED.toColor().withAlpha(20)) - { SkyHanniMod.feature.dungeon.highlightDeathmites } - RenderLivingEntityHelper.setNoHurtTime(entity) { SkyHanniMod.feature.dungeon.highlightDeathmites } - } + if (entity is EntitySilverfish && maxHealth == 1_000_000_000) { + RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_RED.toColor().withAlpha(20)) + { SkyHanniMod.feature.dungeon.highlightDeathmites } + RenderLivingEntityHelper.setNoHurtTime(entity) { SkyHanniMod.feature.dungeon.highlightDeathmites } } } }
\ No newline at end of file |