aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-08 03:28:52 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-08 03:28:52 +0200
commit3ba6a1b438b4bb4d7143903bc477a1493508c54c (patch)
tree705b421f6f5a2d2b2a194c1e79d3b50d3785a3b6 /src
parent7b84e7782e63d85bf17a4f9c3d66af5681eecf90 (diff)
downloadskyhanni-3ba6a1b438b4bb4d7143903bc477a1493508c54c.tar.gz
skyhanni-3ba6a1b438b4bb4d7143903bc477a1493508c54c.tar.bz2
skyhanni-3ba6a1b438b4bb4d7143903bc477a1493508c54c.zip
misc code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt10
11 files changed, 46 insertions, 66 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt
index a90520651..b0c08a4e8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt
@@ -103,12 +103,10 @@ class BazaarApi {
private fun checkIfInBazaar(event: InventoryFullyOpenedEvent): Boolean {
val returnItem = event.inventorySize - 5
for ((slot, item) in event.inventoryItems) {
- if (slot == returnItem) {
- if (item.name?.removeColor().let { it == "Go Back" }) {
- val lore = item.getLore()
- if (lore.getOrNull(0)?.removeColor().let { it == "To Bazaar" }) {
- return true
- }
+ if (slot == returnItem && item.name?.removeColor().let { it == "Go Back" }) {
+ val lore = item.getLore()
+ if (lore.getOrNull(0)?.removeColor().let { it == "To Bazaar" }) {
+ return true
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt
index 01f4cbe0b..c2610d930 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt
@@ -142,14 +142,12 @@ class BingoCardDisplay {
if (!LorenzUtils.isBingoProfile) return
if (!config.enabled) return
- if (config.quickToggle) {
- if (ItemUtils.isSkyBlockMenuItem(InventoryUtils.getItemInHand())) {
- val sneaking = Minecraft.getMinecraft().thePlayer.isSneaking
- if (lastSneak != sneaking) {
- lastSneak = sneaking
- if (sneaking) {
- toggleMode()
- }
+ if (config.quickToggle && ItemUtils.isSkyBlockMenuItem(InventoryUtils.getItemInHand())) {
+ val sneaking = Minecraft.getMinecraft().thePlayer.isSneaking
+ if (lastSneak != sneaking) {
+ lastSneak = sneaking
+ if (sneaking) {
+ toggleMode()
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
index 61a6390a6..e740d0af2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
@@ -76,11 +76,9 @@ class BingoNextStepHelper {
}
}
- if (!step.done && !parentDone) {
- if (requirementsToDo == 0) {
- if (!currentSteps.contains(step)) {
- currentSteps = currentSteps.editCopy { add(step) }
- }
+ if (!step.done && !parentDone && requirementsToDo == 0) {
+ if (!currentSteps.contains(step)) {
+ currentSteps = currentSteps.editCopy { add(step) }
}
}
}
@@ -195,10 +193,8 @@ class BingoNextStepHelper {
if (done) return
done = true
updateResult()
- if (!silent) {
- if (config.stepHelper) {
- LorenzUtils.chat("§e[SkyHanni] A bingo goal step is done! ($displayName)")
- }
+ if (!silent && config.stepHelper) {
+ LorenzUtils.chat("§e[SkyHanni] A bingo goal step is done! ($displayName)")
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt
index 971878306..0cf4f5b57 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt
@@ -34,7 +34,7 @@ class ChatFilterGui(private val history: List<ChatManager.MessageFilteringResult
RenderUtils.drawFloatingRectDark(0, 0, w, h)
GlStateManager.translate(5.0, 5.0 - scroll, 0.0)
var mouseX = mouseX - l
- val isMouseButtonDown = if (mouseX in 0..w && mouseY in t..(t + h)) Mouse.isButtonDown(0) else false
+ val isMouseButtonDown = mouseX in 0..w && mouseY in t..(t + h) && Mouse.isButtonDown(0)
var mouseY = mouseY - (t - scroll).toInt()
val sr = ScaledResolution(mc)
GlScissorStack.push(l + 5, t + 5, w + l - 5, h + t - 5, sr)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt
index 73e772b73..eb9ea503e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WarpIsCommand.kt
@@ -14,11 +14,9 @@ class WarpIsCommand {
if (!SkyHanniMod.feature.commands.replaceWarpIs) return
val packet = event.packet
- if (packet is C01PacketChatMessage) {
- if (packet.message.lowercase() == "/warp is") {
- event.isCanceled = true
- LorenzUtils.sendMessageToServer("/is")
- }
+ if (packet is C01PacketChatMessage && packet.message.lowercase() == "/warp is") {
+ event.isCanceled = true
+ LorenzUtils.sendMessageToServer("/is")
}
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
index f843ff942..c58ff7d90 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
@@ -65,10 +65,6 @@ class BurrowWarpHelper {
val playerDistance = playerLocation.distance(target)
val warpDistance = warpPoint.distance(target)
-// println(" ")
-// println("shouldUseWarps")
-// println("playerDistance: ${playerDistance.round(1)}")
-// println("warpDistance: ${warpDistance.round(1)}")
val difference = playerDistance - warpDistance
currentWarp = if (difference > 10) {
warpPoint
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt
index ed2321058..1c420af0c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt
@@ -47,10 +47,8 @@ class BarnFishingTimer {
private fun checkMobs() {
val newCount = if (inHollows) countHollowsMobs() else countMobs()
- if (currentCount == 0) {
- if (newCount > 0) {
- startTime = System.currentTimeMillis()
- }
+ if (currentCount == 0 && newCount > 0) {
+ startTime = System.currentTimeMillis()
}
currentCount = newCount
@@ -67,11 +65,9 @@ class BarnFishingTimer {
.count { it.endsWith("§c❤") }
private fun isRightLocation(): Boolean {
- if (config.barnTimerCrystalHollows) {
- if (IslandType.CRYSTAL_HOLLOWS.isInIsland()) {
- inHollows = true
- return true
- }
+ if (config.barnTimerCrystalHollows && IslandType.CRYSTAL_HOLLOWS.isInIsland()) {
+ inHollows = true
+ return true
}
inHollows = false
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt
index b25d4be39..104d6b25f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt
@@ -340,13 +340,15 @@ object BestiaryData {
for (cat in catList) {
newDisplay.add(buildList {
add(" §7- ${cat.name}§7: ")
- if (cat.familiesCompleted == cat.totalFamilies) {
- add("§c§lCompleted!")
- } else if (cat.familiesFound == cat.totalFamilies) {
- add("§b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed")
- } else if (cat.familiesFound < cat.totalFamilies) {
- add("§b${cat.familiesFound}§7/§b${cat.totalFamilies} §7found, §b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed")
+ val element = when {
+ cat.familiesCompleted == cat.totalFamilies -> "§c§lCompleted!"
+ cat.familiesFound == cat.totalFamilies -> "§b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed"
+ cat.familiesFound < cat.totalFamilies ->
+ "§b${cat.familiesFound}§7/§b${cat.totalFamilies} §7found, §b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed"
+
+ else -> continue
}
+ add(element)
})
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt
index 5557309a2..d7bee2948 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt
@@ -23,8 +23,7 @@ class BrewingStandOverlay {
13, // Ingredient input
21, // Progress
42, // Output right side
- -> {
- }
+ -> Unit
else -> return
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt
index fb6095059..e6d57a184 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt
@@ -37,14 +37,17 @@ class AshfangBlazes {
if (list.size == 1) {
val armorStand = list[0]
blazeArmorStand[entity] = armorStand
- if (armorStand.name.contains("Ashfang Follower")) {
- blazeColor[entity] = LorenzColor.DARK_GRAY
- } else if (armorStand.name.contains("Ashfang Underling")) {
- blazeColor[entity] = LorenzColor.RED
- } else if (armorStand.name.contains("Ashfang Acolyte")) {
- blazeColor[entity] = LorenzColor.BLUE
- } else {
- blazeArmorStand.remove(entity)
+ val color = when {
+ armorStand.name.contains("Ashfang Follower") -> LorenzColor.DARK_GRAY
+ armorStand.name.contains("Ashfang Underling") -> LorenzColor.RED
+ armorStand.name.contains("Ashfang Acolyte") -> LorenzColor.BLUE
+ else -> {
+ blazeArmorStand.remove(entity)
+ null
+ }
+ }
+ color?.let {
+ blazeColor[entity] = it
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt
index 9d61e1393..c518d1317 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt
@@ -28,14 +28,8 @@ class BlazeSlayerFirePitsWarning {
val difference = System.currentTimeMillis() - lastFirePitsWarning
- if (difference > 0) {
- if (difference <= 2_000) {
- if (event.isMod(10)) {
- if (config.firePitsWarning) {
- SoundUtils.createSound("random.orb", 0.8f).playSound()
- }
- }
- }
+ if (difference in 1..2_000 && event.isMod(10) && config.firePitsWarning) {
+ SoundUtils.createSound("random.orb", 0.8f).playSound()
}
}