Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,8 @@ Maven
* Note: To eliminate any errors or warnings, you should try and match the same version JavaSteam uses.
<br><br>
* Content Downloading:
* If you plan on working with Content Downloading, Depot files may be compressed with Zstd *(Zstandard)*.
* You will need to implement the correct type
of [ztd implementation](https://mvnrepository.com/artifact/com.github.luben/zstd-jni) if using JVM or Android.
* Android uses `aar` for the library type.
* Add the following dependencies to your project: [XZ For Java](https://mvnrepository.com/artifact/org.tukaani/xz) and [ZSTD JNI](https://mvnrepository.com/artifact/com.github.luben/zstd-jni).
* ZSTD for android uses `aar` for the libray type.

You can find the latest version of these dependencies JavaSteam
supports [here](https://github.com/Longi94/JavaSteam/blob/master/gradle/libs.versions.toml).
Expand Down
14 changes: 10 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ sourceSets.main {
)
}

/* Basic Java 9 JPMS support */
tasks.jar {
manifest {
attributes["Automatic-Module-Name"] = "in.dragonbra.javasteam"
}
}

/* Dependencies */
tasks["lintKotlinMain"].dependsOn("formatKotlin")
tasks["check"].dependsOn("jacocoTestReport")
Expand All @@ -126,18 +133,17 @@ tasks.withType<FormatTask> {

dependencies {
implementation(libs.bundles.ktor)
implementation(libs.commons.io)
implementation(libs.commons.lang3)
implementation(libs.commons.validator)
implementation(libs.gson)
implementation(libs.kotlin.coroutines)
implementation(libs.kotlin.stdib)
implementation(libs.okHttp)
implementation(libs.protobuf.java)
implementation(libs.xz)
compileOnly(libs.xz)
compileOnly(libs.zstd)

testImplementation(platform(libs.tests.junit.bom))
testImplementation(libs.bundles.testing)
testRuntimeOnly(libs.tests.junit.platform)
}

/* Artifact publishing */
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ dependencies {
implementation(gradleApi())

// https://mvnrepository.com/artifact/commons-io/commons-io
implementation("commons-io:commons-io:2.18.0")
implementation("commons-io:commons-io:2.20.0")
// https://mvnrepository.com/artifact/com.squareup/kotlinpoet
implementation("com.squareup:kotlinpoet:2.0.0")
implementation("com.squareup:kotlinpoet:2.2.0")
}

gradlePlugin {
Expand Down
70 changes: 36 additions & 34 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,37 @@
# ****

[versions]
# Java / Kotlin versions
java = "11"
kotlin = "2.1.20" # https://kotlinlang.org/docs/releases.html#release-details
kotlin = "2.2.0" # https://kotlinlang.org/docs/releases.html#release-details
dokka = "2.0.0" # https://mvnrepository.com/artifact/org.jetbrains.dokka/dokka-gradle-plugin
kotlinter = "5.0.2" # https://plugins.gradle.org/plugin/org.jmailen.kotlinter
kotlinter = "5.1.1" # https://plugins.gradle.org/plugin/org.jmailen.kotlinter
jacoco = "0.8.13" # https://www.eclemma.org/jacoco

# Standard Library versions
bouncyCastle = "1.80" # https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on
commons-io = "2.19.0" # 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.13.1" # https://mvnrepository.com/artifact/com.google.code.gson/gson
jacoco = "0.8.13" # https://www.eclemma.org/jacoco
commons-lang3 = "3.18.0" # https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
kotlin-coroutines = "1.10.2" # https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core
ktor = "3.2.1" # https://mvnrepository.com/artifact/io.ktor/ktor-client-cio
okHttp = "5.0.0-alpha.14" # https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
protobuf = "4.30.2" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
ktor = "3.2.2" # https://mvnrepository.com/artifact/io.ktor/ktor-client-cio
okHttp = "5.1.0" # https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
protobuf = "4.31.1" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
protobuf-gradle = "0.9.5" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-gradle-plugin
publishPlugin = "2.0.0" # https://mvnrepository.com/artifact/io.github.gradle-nexus/publish-plugin
qrCode = "1.0.1" # https://mvnrepository.com/artifact/pro.leaco.qrcode/console-qrcode
xz = "1.10" # https://mvnrepository.com/artifact/org.tukaani/xz
zstd = "1.5.7-3" # https://search.maven.org/artifact/com.github.luben/zstd-jni
zstd = "1.5.7-4" # https://search.maven.org/artifact/com.github.luben/zstd-jni

# Testing Lib versions
commonsCodec = "1.18.0" # https://mvnrepository.com/artifact/commons-codec/commons-codec
junit5 = "5.11.4" # 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.15.2" # https://mvnrepository.com/artifact/org.mockito/mockito-core
commons-io = "2.20.0" # https://mvnrepository.com/artifact/commons-io/commons-io
commonsCodec = "1.19.0" # https://mvnrepository.com/artifact/commons-codec/commons-codec
junit5 = "5.13.4" # https://mvnrepository.com/artifact/org.junit/junit-bom
mockWebServer = "5.1.0" # https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver3-junit5
mockitoVersion = "5.18.0" # https://mvnrepository.com/artifact/org.mockito/mockito-core

# Samples
bouncyCastle = "1.81" # https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on
gson = "2.13.1" # https://mvnrepository.com/artifact/com.google.code.gson/gson
qrCode = "1.0.1" # https://mvnrepository.com/artifact/pro.leaco.qrcode/console-qrcode

[libraries]
bouncyCastle = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncyCastle" }
commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" }
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commons-lang3" }
commons-validator = { module = "commons-validator:commons-validator", version.ref = "commons-validator" }
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" }
kotlin-stdib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
Expand All @@ -47,17 +43,23 @@ ktor-client-websocket = { module = "io.ktor:ktor-client-websockets", version.ref
okHttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okHttp" }
protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "protobuf" }
protobuf-protoc = { module = "com.google.protobuf:protoc", version.ref = "protobuf" }
qrCode = { module = "pro.leaco.qrcode:console-qrcode", version.ref = "qrCode" }
xz = { module = "org.tukaani:xz", version.ref = "xz" }
zstd = { module = "com.github.luben:zstd-jni", version.ref = "zstd" }

# Tests
test-commons-codec = { module = "commons-codec:commons-codec", version.ref = "commonsCodec" }
test-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit5" }
test-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit5" }
test-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit5" }
test-commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" }
test-mock-core = { module = "org.mockito:mockito-core", version.ref = "mockitoVersion" }
test-mock-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockitoVersion" }
test-mock-webserver3 = { module = "com.squareup.okhttp3:mockwebserver3-junit5", version.ref = "mockWebServer" }
test-mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockitoVersion" }
test-mockito-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockitoVersion" }
tests-junit-bom = { module = "org.junit:junit-bom", version.ref = "junit5" }
tests-junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" }
tests-junit-platform = { module = "org.junit.platform:junit-platform-launcher" }

# Samples
bouncyCastle = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncyCastle" }
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
qrCode = { module = "pro.leaco.qrcode:console-qrcode", version.ref = "qrCode" }

[plugins]
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
Expand All @@ -69,14 +71,14 @@ protobuf-gradle = { id = "com.google.protobuf", version.ref = "protobuf-gradle"
[bundles]
testing = [
"bouncyCastle",
"zstd",
"xz",
"test-commons-codec",
"test-jupiter-api",
"test-jupiter-engine",
"test-jupiter-params",
"test-commons-io",
"test-mock-core",
"test-mock-jupiter",
"test-mock-webserver3",
"test-mockito-core",
"test-mockito-jupiter",
"zstd"
"tests-junit-jupiter",
]

ktor = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import `in`.dragonbra.javasteam.steam.cdn.Server
import `in`.dragonbra.javasteam.steam.handlers.steamapps.PICSProductInfo
import `in`.dragonbra.javasteam.steam.handlers.steamapps.PICSRequest
import `in`.dragonbra.javasteam.steam.handlers.steamapps.SteamApps
import `in`.dragonbra.javasteam.steam.handlers.steamapps.callback.PICSProductInfoCallback
import `in`.dragonbra.javasteam.steam.handlers.steamcontent.SteamContent
import `in`.dragonbra.javasteam.steam.steamclient.SteamClient
import `in`.dragonbra.javasteam.types.ChunkData
Expand Down Expand Up @@ -104,7 +103,7 @@ class ContentDownloader(val steamClient: SteamClient) {
private fun getAppDirName(app: PICSProductInfo): String {
val installDirKeyValue = app.keyValues["config"]["installdir"]

return if (installDirKeyValue != KeyValue.INVALID) installDirKeyValue.value else app.id.toString()
return if (installDirKeyValue != KeyValue.INVALID) installDirKeyValue.value!! else app.id.toString()
}

private fun getAppInfo(
Expand All @@ -113,7 +112,7 @@ class ContentDownloader(val steamClient: SteamClient) {
): Deferred<PICSProductInfo?> = parentScope.async {
val steamApps = steamClient.getHandler(SteamApps::class.java)
val callback = steamApps?.picsGetProductInfo(PICSRequest(appId))?.await()
val apps = callback?.results?.flatMap { (it as PICSProductInfoCallback).apps.values }
val apps = callback?.results?.flatMap { it.apps.values }

if (apps.isNullOrEmpty()) {
logger.error("Received empty apps list in PICSProductInfo response for $appId")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Lobby(
return metadata
}

metadata[value.name] = value.value
metadata[value.name!!] = value.value!!
}

return metadata.toMap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class SteamUserStats : ClientMsgHandler() {
}

// JavaSteam addition.

/**
* Gets the Stats-Schema for the specified app. This schema includes Global Achievements and Stats,
* @param appId The appID of the game.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class SteamClient @JvmOverloads constructor(
}

//region Handlers

/**
* Adds a new handler to the internal list of message handlers.
* @param handler The handler to add.
Expand Down Expand Up @@ -150,6 +151,7 @@ class SteamClient @JvmOverloads constructor(
//endregion

//region Callbacks

/**
* Gets the next callback object in the queue, and removes it.
* @return The next callback in the queue, or null if no callback is waiting.
Expand Down Expand Up @@ -196,6 +198,7 @@ class SteamClient @JvmOverloads constructor(
//endregion

//region Jobs

/**
* Returns the next available JobID for job based messages.
* @return The next available JobID.
Expand Down
Loading