From d7d88c07cf5ccbb39cb8d35d3b254ea89466929e Mon Sep 17 00:00:00 2001 From: LossyDragon Date: Tue, 3 Sep 2024 11:57:23 -0500 Subject: [PATCH 1/6] Update dependency versions --- buildSrc/build.gradle.kts | 4 ++-- gradle/libs.versions.toml | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 5b28457a..4a67e1e2 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -13,9 +13,9 @@ dependencies { implementation(gradleApi()) // https://mvnrepository.com/artifact/commons-io/commons-io - implementation("commons-io:commons-io:2.16.0") + implementation("commons-io:commons-io:2.16.1") // https://mvnrepository.com/artifact/com.squareup/kotlinpoet - implementation("com.squareup:kotlinpoet:1.16.0") + implementation("com.squareup:kotlinpoet:1.18.1") } gradlePlugin { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4dda6438..9f8d3486 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,30 +6,30 @@ [versions] # Java / Kotlin versions java = "11" -kotlin = "1.9.23" # https://kotlinlang.org/docs/releases.html#release-details +kotlin = "2.0.20" # https://kotlinlang.org/docs/releases.html#release-details dokka = "1.9.20" # https://mvnrepository.com/artifact/org.jetbrains.dokka/dokka-gradle-plugin -kotlinter = "4.3.0" # https://plugins.gradle.org/plugin/org.jmailen.kotlinter +kotlinter = "4.4.1" # https://plugins.gradle.org/plugin/org.jmailen.kotlinter # Standard Library versions -bouncyCastle = "1.78" # https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on -commons-io = "2.16.0" # https://mvnrepository.com/artifact/commons-io/commons-io -commons-lang3 = "3.14.0" # https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -commons-validator = "1.8.0" # https://mvnrepository.com/artifact/commons-validator/commons-validator -gson = "2.10.1" # https://mvnrepository.com/artifact/com.google.code.gson/gson +bouncyCastle = "1.78.1" # https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on +commons-io = "2.16.1" # https://mvnrepository.com/artifact/commons-io/commons-io +commons-lang3 = "3.17.0" # https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 +commons-validator = "1.9.0" # https://mvnrepository.com/artifact/commons-validator/commons-validator +gson = "2.11.0" # https://mvnrepository.com/artifact/com.google.code.gson/gson jacoco = "0.8.12" # https://www.eclemma.org/jacoco -javaWebSocket = "1.5.6" # https://mvnrepository.com/artifact/org.java-websocket/Java-WebSocket -kotlin-coroutines = "1.8.0" # https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core -okHttp = "5.0.0-alpha.12" # https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -protobuf = "4.26.1" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java +javaWebSocket = "1.5.7" # https://mvnrepository.com/artifact/org.java-websocket/Java-WebSocket +kotlin-coroutines = "1.8.1" # https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core +okHttp = "5.0.0-alpha.14" # https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp +protobuf = "4.28.0" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java protobuf-gradle = "0.9.4" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-gradle-plugin publishPlugin = "1.3.0" # https://mvnrepository.com/artifact/io.github.gradle-nexus/publish-plugin qrCode = "1.0.1" # https://mvnrepository.com/artifact/pro.leaco.qrcode/console-qrcode # Testing Lib versions -commonsCodec = "1.16.1" # https://mvnrepository.com/artifact/commons-codec/commons-codec -junit5 = "5.10.2" # https://mvnrepository.com/artifact/org.junit/junit-bom -mockWebServer = "5.0.0-alpha.12" # https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver3-junit5 -mockitoVersion = "5.11.0" # https://mvnrepository.com/artifact/org.mockito/mockito-core +commonsCodec = "1.17.1" # https://mvnrepository.com/artifact/commons-codec/commons-codec +junit5 = "5.11.0" # https://mvnrepository.com/artifact/org.junit/junit-bom +mockWebServer = "5.0.0-alpha.14" # https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver3-junit5 +mockitoVersion = "5.13.0" # https://mvnrepository.com/artifact/org.mockito/mockito-core [libraries] bouncyCastle = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncyCastle" } From 07f4dd9e4f54b922ec787dc8498f6842e5b099ab Mon Sep 17 00:00:00 2001 From: LossyDragon Date: Tue, 3 Sep 2024 11:57:53 -0500 Subject: [PATCH 2/6] Bump version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index db17bdc9..5358f1fe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,7 @@ plugins { allprojects { group = "in.dragonbra" - version = "1.5.0" + version = "1.5.1" } repositories { From 3aea8fb38ebb134c3fbe6054f36cd72c0dd9dbb6 Mon Sep 17 00:00:00 2001 From: LossyDragon Date: Tue, 3 Sep 2024 12:17:13 -0500 Subject: [PATCH 3/6] kotlinter formatting, this brings significant formatting rule changes from ktlint 1.3.0 being released. Mostly just line separator changes to LF --- .editorconfig | 2 ++ .../javasteam/steam/authentication/AuthSession.kt | 4 +--- .../javasteam/steam/steamclient/callbackmgr/Callback.kt | 3 ++- .../steam/steamclient/callbacks/CMListCallback.kt | 1 - .../java/in/dragonbra/javasteam/types/AsyncJobMultiple.kt | 4 +--- .../java/in/dragonbra/javasteam/types/AsyncJobSingle.kt | 8 ++------ 6 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.editorconfig b/.editorconfig index 4c68c0bc..16fc6000 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,6 +5,8 @@ charset = utf-8 insert_final_newline = true trim_trailing_whitespace = true +end_of_line = lf + [*.{kt,kts}] ij_kotlin_packages_to_use_import_on_demand = java.util.**, in.dragonbra.javasteam.protobufs.steamclient.**, kotlinx.coroutines.** indent_size = 4 diff --git a/src/main/java/in/dragonbra/javasteam/steam/authentication/AuthSession.kt b/src/main/java/in/dragonbra/javasteam/steam/authentication/AuthSession.kt index cb363122..22f5e490 100644 --- a/src/main/java/in/dragonbra/javasteam/steam/authentication/AuthSession.kt +++ b/src/main/java/in/dragonbra/javasteam/steam/authentication/AuthSession.kt @@ -56,9 +56,7 @@ open class AuthSession( * @return An [AuthPollResult] containing tokens which can be used to log in to Steam. */ @Throws(AuthenticationException::class) - fun pollingWaitForResultCompat(): CompletableFuture { - return scope.future { pollingWaitForResult() } - } + fun pollingWaitForResultCompat(): CompletableFuture = scope.future { pollingWaitForResult() } /** * Handle any 2-factor authentication, and if necessary poll for updates until authentication succeeds. diff --git a/src/main/java/in/dragonbra/javasteam/steam/steamclient/callbackmgr/Callback.kt b/src/main/java/in/dragonbra/javasteam/steam/steamclient/callbackmgr/Callback.kt index 644b7fd5..77c6156a 100644 --- a/src/main/java/in/dragonbra/javasteam/steam/steamclient/callbackmgr/Callback.kt +++ b/src/main/java/in/dragonbra/javasteam/steam/steamclient/callbackmgr/Callback.kt @@ -10,7 +10,8 @@ class Callback @JvmOverloads constructor( func: Consumer?, private var mgr: ICallbackMgrInternals? = null, var jobID: JobID = JobID.INVALID, -) : CallbackBase(), Closeable { +) : CallbackBase(), + Closeable { private val onRun = func diff --git a/src/main/java/in/dragonbra/javasteam/steam/steamclient/callbacks/CMListCallback.kt b/src/main/java/in/dragonbra/javasteam/steam/steamclient/callbacks/CMListCallback.kt index 2df49002..7bda2f53 100644 --- a/src/main/java/in/dragonbra/javasteam/steam/steamclient/callbacks/CMListCallback.kt +++ b/src/main/java/in/dragonbra/javasteam/steam/steamclient/callbacks/CMListCallback.kt @@ -5,7 +5,6 @@ import `in`.dragonbra.javasteam.steam.discovery.ServerRecord import `in`.dragonbra.javasteam.steam.steamclient.callbackmgr.CallbackMsg import `in`.dragonbra.javasteam.util.NetHelpers import java.net.InetSocketAddress -import java.util.* /** * This callback is received when the client has received the CM list from Steam. diff --git a/src/main/java/in/dragonbra/javasteam/types/AsyncJobMultiple.kt b/src/main/java/in/dragonbra/javasteam/types/AsyncJobMultiple.kt index 85c2f8ad..ea6228a8 100644 --- a/src/main/java/in/dragonbra/javasteam/types/AsyncJobMultiple.kt +++ b/src/main/java/in/dragonbra/javasteam/types/AsyncJobMultiple.kt @@ -30,9 +30,7 @@ class AsyncJobMultiple( registerJob(client) } - fun toDeferred(): CompletableDeferred { - return tcs - } + fun toDeferred(): CompletableDeferred = tcs override fun addResult(callback: CallbackMsg?): Boolean { if (callback == null) { diff --git a/src/main/java/in/dragonbra/javasteam/types/AsyncJobSingle.kt b/src/main/java/in/dragonbra/javasteam/types/AsyncJobSingle.kt index 5e4c0f95..61b52fc7 100644 --- a/src/main/java/in/dragonbra/javasteam/types/AsyncJobSingle.kt +++ b/src/main/java/in/dragonbra/javasteam/types/AsyncJobSingle.kt @@ -19,14 +19,10 @@ class AsyncJobSingle(client: SteamClient, jobId: JobID) : Async registerJob(client) } - fun toDeferred(): CompletableDeferred { - return tcs - } + fun toDeferred(): CompletableDeferred = tcs @Throws(CancellationException::class) - fun runBlock(): T { - return runBlocking { toDeferred().await() } - } + fun runBlock(): T = runBlocking { toDeferred().await() } override fun addResult(callback: CallbackMsg?): Boolean { requireNotNull(callback) { "callback must not be null" } From e4e2b70f062ff7c2cb69535da82f001197856f4f Mon Sep 17 00:00:00 2001 From: LossyDragon Date: Tue, 3 Sep 2024 12:31:15 -0500 Subject: [PATCH 4/6] kdoc fixes and potential npe --- .../javasteam/steam/handlers/steamfriends/SteamFriends.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/in/dragonbra/javasteam/steam/handlers/steamfriends/SteamFriends.kt b/src/main/java/in/dragonbra/javasteam/steam/handlers/steamfriends/SteamFriends.kt index 92faadda..61c0ebd5 100644 --- a/src/main/java/in/dragonbra/javasteam/steam/handlers/steamfriends/SteamFriends.kt +++ b/src/main/java/in/dragonbra/javasteam/steam/handlers/steamfriends/SteamFriends.kt @@ -533,7 +533,7 @@ class SteamFriends : ClientMsgHandler() { * Results are returned in [PersonaStatesCallback]. * * @param steamIdList A list of SteamIDs to request the info of. - * @param requestedInfo The requested info flags. If none specified, this uses [SteamConfiguration.getDefaultPersonaStateFlags]. + * @param requestedInfo The requested info flags. If none specified, this uses [SteamConfiguration.defaultPersonaStateFlags]. */ @JvmOverloads fun requestFriendInfo(steamIdList: List, requestedInfo: Int = 0) { @@ -557,7 +557,7 @@ class SteamFriends : ClientMsgHandler() { * Results are returned in [PersonaStatesCallback]. * * @param steamID A SteamID to request the info of. - * @param requestedInfo The requested info flags. If none specified, this uses [SteamConfiguration.getDefaultPersonaStateFlags]. + * @param requestedInfo The requested info flags. If none specified, this uses [SteamConfiguration.defaultPersonaStateFlags]. */ @JvmOverloads fun requestFriendInfo(steamID: SteamID, requestedInfo: Int = 0) { @@ -786,7 +786,9 @@ class SteamFriends : ClientMsgHandler() { private fun handleFriendsList(packetMsg: IPacketMsg) { val list = ClientMsgProtobuf(CMsgClientFriendsList::class.java, packetMsg) - cache.localUser.steamID = client.steamID + client.steamID?.let { + cache.localUser.steamID = it + } if (!list.body.bincremental) { // if we're not an incremental update, the message contains all friends, so we should clear our current list From a319ac4f15cd58075501a52fbe68c23162390df8 Mon Sep 17 00:00:00 2001 From: LossyDragon Date: Tue, 3 Sep 2024 18:36:32 -0500 Subject: [PATCH 5/6] Update gitignore --- .gitignore | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d0c281a9..e2b5519c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,11 +21,6 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* -.gradle -/build/ -/buildSrc/build/ -/javasteam-tf/build/ - # Ignore Gradle GUI config gradle-app.setting @@ -67,10 +62,19 @@ crashlytics.properties crashlytics-build.properties fabric.properties +# JavaSteam +.gradle +/build/ /netlogs/ +/buildSrc/build/ +/javasteam-tf/build/ # JavaSteam Samples cellid.txt loginkey.txt sentry.bin server_list.bin + +# Kotlin 2.0 +./.kotlin/sessions/ +*.salive From d6c2cd6494069a0f0d60234a43eeabb3dfd60ca5 Mon Sep 17 00:00:00 2001 From: LossyDragon Date: Tue, 3 Sep 2024 18:37:41 -0500 Subject: [PATCH 6/6] Update gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e2b5519c..1f49785d 100644 --- a/.gitignore +++ b/.gitignore @@ -76,5 +76,5 @@ sentry.bin server_list.bin # Kotlin 2.0 -./.kotlin/sessions/ +/.kotlin/sessions/ *.salive