mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
Compare commits
3 commits
ebf25a65f7
...
5c374462ef
Author | SHA1 | Date | |
---|---|---|---|
|
5c374462ef | ||
|
ef5695f679 | ||
|
b4331819cb |
6 changed files with 41 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
|||
package pro.gravit.launcher.client;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import pro.gravit.launcher.profiles.ClientProfile;
|
||||
|
@ -162,9 +163,13 @@ private Result modernPing(HInput input, HOutput output) throws IOException {
|
|||
}
|
||||
|
||||
// Parse JSON response
|
||||
JsonObject object = JsonParser.parseString(response).getAsJsonObject();
|
||||
JsonElement element = JsonParser.parseString(response);
|
||||
if(element.isJsonPrimitive()) {
|
||||
throw new IOException(element.getAsString());
|
||||
}
|
||||
JsonObject object = element.getAsJsonObject();
|
||||
if (object.has("error")) {
|
||||
throw new IOException(object.get("error").getAsString());
|
||||
throw new IOException(object.get("error").getAsString()); // May be not needed?
|
||||
}
|
||||
JsonObject playersObject = object.get("players").getAsJsonObject();
|
||||
int online = playersObject.get("online").getAsInt();
|
||||
|
|
|
@ -27,6 +27,21 @@ public OptionalView(OptionalView view) {
|
|||
this.all = view.all;
|
||||
}
|
||||
|
||||
public OptionalView(ClientProfile profile, OptionalView old) {
|
||||
this(profile);
|
||||
for(OptionalFile oldFile : old.all) {
|
||||
OptionalFile newFile = findByName(oldFile.name);
|
||||
if(newFile == null) {
|
||||
continue;
|
||||
}
|
||||
if(old.isEnabled(oldFile)) {
|
||||
enable(newFile, old.installInfo.get(oldFile).isManual, (file, status) -> {});
|
||||
} else {
|
||||
disable(newFile, (file, status) -> {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends OptionalAction> Set<T> getActionsByClass(Class<T> clazz) {
|
||||
Set<T> results = new HashSet<>();
|
||||
|
@ -42,6 +57,19 @@ public <T extends OptionalAction> Set<T> getActionsByClass(Class<T> clazz) {
|
|||
return results;
|
||||
}
|
||||
|
||||
public OptionalFile findByName(String name) {
|
||||
for(OptionalFile file : all) {
|
||||
if(name.equals(file.name)) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isEnabled(OptionalFile file) {
|
||||
return enabled.contains(file);
|
||||
}
|
||||
|
||||
public Set<OptionalAction> getEnabledActions() {
|
||||
Set<OptionalAction> results = new HashSet<>();
|
||||
for (OptionalFile e : enabled) {
|
||||
|
|
|
@ -6,9 +6,9 @@ public final class Version implements Comparable<Version> {
|
|||
|
||||
public static final int MAJOR = 5;
|
||||
public static final int MINOR = 3;
|
||||
public static final int PATCH = 5;
|
||||
public static final int PATCH = 6;
|
||||
public static final int BUILD = 1;
|
||||
public static final Version.Type RELEASE = Type.STABLE;
|
||||
public static final Version.Type RELEASE = Type.DEV;
|
||||
public final int major;
|
||||
public final int minor;
|
||||
public final int patch;
|
||||
|
|
|
@ -64,7 +64,7 @@ pack project(':LauncherAPI')
|
|||
|
||||
shadowJar {
|
||||
duplicatesStrategy = 'EXCLUDE'
|
||||
classifier = null
|
||||
archiveClassifier = null
|
||||
relocate 'io.netty', 'pro.gravit.repackage.io.netty'
|
||||
configurations = [project.configurations.pack]
|
||||
exclude 'module-info.class'
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
plugins {
|
||||
id 'com.github.johnrengelman.shadow' version '5.2.0' apply false
|
||||
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
|
||||
id 'maven-publish'
|
||||
id 'signing'
|
||||
id 'org.openjfx.javafxplugin' version '0.0.10' apply false
|
||||
}
|
||||
group = 'pro.gravit.launcher'
|
||||
version = '5.3.5'
|
||||
version = '5.3.6-SNAPSHOT'
|
||||
|
||||
apply from: 'props.gradle'
|
||||
|
||||
|
|
2
modules
2
modules
|
@ -1 +1 @@
|
|||
Subproject commit c0d181172391f9540f1477407daab7499974fa2a
|
||||
Subproject commit 0fbbc50f875b477078d61de2135b8d3600851ebe
|
Loading…
Reference in a new issue