显示 Forge 发版时间 (#3256)

* 显示时间

* Fix

* update

* update

---------

Co-authored-by: Glavo <zjx001202@gmail.com>
This commit is contained in:
Zkitefly 2024-08-31 00:44:43 +08:00 committed by GitHub
parent 738000ff39
commit 48417b9b7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -33,7 +33,7 @@ public final class ForgeVersion implements Validation {
private final String jobver;
private final String version;
private final int build;
private final double modified;
private final long modified;
private final String[][] files;
/**
@ -44,7 +44,7 @@ public final class ForgeVersion implements Validation {
this(null, null, null, null, 0, 0, null);
}
public ForgeVersion(String branch, String mcversion, String jobver, String version, int build, double modified, String[][] files) {
public ForgeVersion(String branch, String mcversion, String jobver, String version, int build, long modified, String[][] files) {
this.branch = branch;
this.mcversion = mcversion;
this.jobver = jobver;
@ -74,7 +74,7 @@ public final class ForgeVersion implements Validation {
return build;
}
public double getModified() {
public long getModified() {
return modified;
}

View File

@ -23,6 +23,7 @@ import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.io.HttpRequest;
import org.jackhuang.hmcl.util.versioning.VersionNumber;
import java.time.Instant;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
@ -79,8 +80,12 @@ public final class ForgeVersionList extends VersionList<ForgeRemoteVersion> {
if (jar == null)
continue;
versions.put(gameVersion, new ForgeRemoteVersion(
toLookupVersion(version.getGameVersion()), version.getVersion(), null, Collections.singletonList(jar)
toLookupVersion(version.getGameVersion()),
version.getVersion(),
version.getModified() > 0 ? Instant.ofEpochSecond(version.getModified()) : null,
Collections.singletonList(jar)
));
}
}