summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/test
diff options
context:
space:
mode:
authorWalker Selby <git@walkerselby.com>2023-09-29 11:30:27 -0700
committerGitHub <noreply@github.com>2023-09-29 20:30:27 +0200
commit343d5d9cea12beaf7a8dfabda2f61ad940be592a (patch)
treeceb0a82790eaa1a1babfe4a2e05220378037a748 /src/main/java/at/hannibal2/skyhanni/test
parentb364b6da62668ea44dfc23180fe70c13ec707804 (diff)
downloadskyhanni-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/test')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt22
6 files changed, 16 insertions, 56 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt
index f21d4cac0..59df2bf37 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt
@@ -42,9 +42,7 @@ class ParkourWaypointSaver {
}
if (config.saveKey == key) {
val newLocation = LorenzVec.getBlockBelowPlayer()
- if (locations.isNotEmpty()) {
- if (newLocation == locations.last()) return
- }
+ if (locations.isNotEmpty() && newLocation == locations.last()) return
locations.add(newLocation)
update()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt
index c1aa5a313..f80b96f8f 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt
@@ -220,12 +220,8 @@ object SkyHanniConfigSearchResetCommand {
val fieldName = "$parentName.$name"
val newObj = field.makeAccessible().get(obj)
map[fieldName] = newObj
- if (newObj != null) {
- if (newObj !is Boolean && newObj !is String && newObj !is Long && newObj !is Int && newObj !is Double) {
- if (newObj !is Position && !newObj.javaClass.isEnum) {
- map.putAll(loadAllFields(fieldName, newObj, depth + 1))
- }
- }
+ if (newObj != null && newObj !is Boolean && newObj !is String && newObj !is Long && newObj !is Int && newObj !is Double && newObj !is Position && !newObj.javaClass.isEnum) {
+ map.putAll(loadAllFields(fieldName, newObj, depth + 1))
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
index 66b29a3d7..a50d684de 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
@@ -182,11 +182,9 @@ class SkyHanniDebugsAndTests {
val x = LorenzUtils.formatDouble(location.x + 0.001).replace(",", ".")
val y = LorenzUtils.formatDouble(location.y + 0.001).replace(",", ".")
val z = LorenzUtils.formatDouble(location.z + 0.001).replace(",", ".")
- if (args.size == 1) {
- if (args[0].equals("json", false)) {
- OSUtils.copyToClipboard("\"$x:$y:$z\"")
- return
- }
+ if (args.size == 1 && args[0].equals("json", false)) {
+ OSUtils.copyToClipboard("\"$x:$y:$z\"")
+ return
}
OSUtils.copyToClipboard("LorenzVec($x, $y, $z)")
@@ -197,12 +195,10 @@ class SkyHanniDebugsAndTests {
}
fun debugData(args: Array<String>) {
- if (args.size == 2) {
- if (args[0] == "profileName") {
- HypixelData.profileName = args[1].lowercase()
- LorenzUtils.chat("§eManually set profileName to '${HypixelData.profileName}'")
- return
- }
+ if (args.size == 2 && args[0] == "profileName") {
+ HypixelData.profileName = args[1].lowercase()
+ LorenzUtils.chat("§eManually set profileName to '${HypixelData.profileName}'")
+ return
}
val builder = StringBuilder()
builder.append("```\n")
diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt
index fdb4a58c3..993778afc 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt
@@ -48,21 +48,17 @@ object TestCopyBestiaryValues {
val backItem = event.inventoryItems[3 + 9 * 5 + 3]
if (backItem == null) {
-// println("first is null!")
return
}
if (backItem.getLore().none { it.contains("Bestiary Milestone") }) {
-// println("wrong first: ${backItem.getLore()}")
return
}
val rankingItem = event.inventoryItems[3 + 9 * 5 + 2]
if (rankingItem == null) {
-// println("second is null!")
return
}
if (rankingItem.getLore().none { it.contains("Ranking") }) {
-// println("wrong second: ${rankingItem.getLore()}")
return
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
index 5852c9922..cc909469e 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
@@ -86,11 +86,9 @@ private fun Throwable.getExactStackTrace(full: Boolean, parent: List<String> = e
for (traceElement in stackTrace) {
var text = "\tat $traceElement"
- if (!full) {
- if (text in parent) {
- println("broke at: $text")
- break
- }
+ if (!full && text in parent) {
+ println("broke at: $text")
+ break
}
if (!full) {
for ((from, to) in replace) {
@@ -98,11 +96,9 @@ private fun Throwable.getExactStackTrace(full: Boolean, parent: List<String> = e
}
}
add(text)
- if (!full) {
- if (breakAfter.any { text.contains(it) }) {
- println("breakAfter: $text")
- break
- }
+ if (!full && breakAfter.any { text.contains(it) }) {
+ println("breakAfter: $text")
+ break
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt
index 51c5a28fb..b7c4ae4a1 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt
@@ -135,28 +135,6 @@ object CopyNearbyEntitiesCommand {
val skinTexture = entity.getSkinTexture()
resultList.add("- skin texture: $skinTexture")
-
-// val gameProfile = entity.gameProfile
-// if (gameProfile == null) {
-// resultList.add("- gameProfile is null!")
-// } else {
-// val id = gameProfile.id
-// val name = gameProfile.name
-//
-// resultList.add("- gameProfile id: $id")
-// resultList.add("- gameProfile name: $name")
-// val properties = gameProfile.properties
-// resultList.add("- gameProfile properties: (${properties.size()})")
-// for (entry in properties.entries()) {
-// val key = entry.key
-// val property = entry.value
-// resultList.add("- key: '$key'")
-// val name1 = property.name
-// val value = property.value
-// resultList.add("- property name: '$name1'")
-// resultList.add("- property value: '$value'")
-// }
-// }
}
}
resultList.add("")