Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only apply prism message to versions that require it #73

Merged
merged 1 commit into from
Aug 1, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public typealias Logs = List<Log>
public open class Log {
public val environment: Environment = Environment()
public var launcher: Launcher? = null
public var launcherVersion: String? = null
public var url: URL? = null

public val extraEmbeds: MutableList<suspend (EmbedBuilder).() -> Unit> = mutableListOf()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package org.quiltmc.community.cozy.modules.logs.parsers

import com.github.zafarkhaja.semver.Version
import org.quiltmc.community.cozy.modules.logs.data.Launcher
import org.quiltmc.community.cozy.modules.logs.data.Log
import org.quiltmc.community.cozy.modules.logs.data.Order
Expand Down Expand Up @@ -36,13 +37,25 @@ public class LauncherParser : LogParser() {

log.launcher = Launcher(launcher, match!!.groups[1]?.value)

if (launcher == Launcher.Prism) {
log.addMessage(
"**It looks like you're using Prism.** Please note that Prism [currently breaks uploaded logs]" +
// MultiMC-derived launchers declare their version in the log, so we can parse it
if (launcher == Launcher.MultiMC || launcher == Launcher.PolyMC || launcher == Launcher.Prism) {
val message: String? = match.groups[1]?.value
if (message != null) {
log.launcherVersion = message.split("version: ")[1]
}
}

if (launcher == Launcher.Prism && log.launcherVersion != null) {
val version: Version = Version.valueOf(log.launcherVersion!!)
if (version.compareTo(Version.valueOf("7.0")) < 0) {
log.addMessage(
"**It looks like you're using an outdated version of Prism.** +" +
"Please note that Prism [formerly broke uploaded logs]" +
"(https://github.com/PrismLauncher/PrismLauncher/issues/930), and the information " +
"provided here may be incomplete. Until this is fixed, please consider manually " +
"uploading your `latest.log` file to the channel instead."
)
"provided here may be incomplete. Please either update Prism to 7.0+ or manually " +
"upload your `latest.log` file to the channel instead."
)
}
}
}
}
Loading