mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
Merge branch 'dev' of github.com:GravitLauncher/Launcher into dev
This commit is contained in:
commit
e226cb397d
6 changed files with 7 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -109,3 +109,4 @@ cmd.bat
|
|||
cmd.sh
|
||||
## PVS Studio
|
||||
.PVS-Studio/
|
||||
project/target
|
||||
|
|
|
@ -43,8 +43,8 @@ public synchronized Connection getConnection() throws SQLException {
|
|||
PGSimpleDataSource postgresqlSource = new PGSimpleDataSource();
|
||||
|
||||
// Set credentials
|
||||
postgresqlSource.setServerName(address);
|
||||
postgresqlSource.setPortNumber(port);
|
||||
postgresqlSource.setServerNames(new String[] {address}); //TODO support multinode PostgreSQL DB
|
||||
postgresqlSource.setPortNumbers(new int[] {port});
|
||||
postgresqlSource.setUser(username);
|
||||
postgresqlSource.setPassword(password);
|
||||
postgresqlSource.setDatabaseName(database);
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
import java.util.Map;
|
||||
|
||||
public final class UnindexAssetCommand extends Command {
|
||||
private static final JsonParser parser = new JsonParser();
|
||||
|
||||
public UnindexAssetCommand(LaunchServer server) {
|
||||
super(server);
|
||||
}
|
||||
|
@ -51,7 +49,7 @@ public void invoke(String... args) throws Exception {
|
|||
JsonObject objects;
|
||||
LogHelper.subInfo("Reading asset index file: '%s'", indexFileName);
|
||||
try (BufferedReader reader = IOHelper.newReader(IndexAssetCommand.resolveIndexFile(inputAssetDir, indexFileName))) {
|
||||
objects = parser.parse(reader).getAsJsonObject().get("objects").getAsJsonObject();
|
||||
objects = JsonParser.parseReader(reader).getAsJsonObject().get("objects").getAsJsonObject();
|
||||
}
|
||||
|
||||
// Restore objects
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
public final class ServerPinger {
|
||||
private final JsonParser parser = new JsonParser();
|
||||
|
||||
public static final class Result {
|
||||
|
||||
|
@ -184,7 +183,7 @@ private Result modernPing(HInput input, HOutput output) throws IOException {
|
|||
}
|
||||
|
||||
// Parse JSON response
|
||||
JsonObject object = parser.parse(response).getAsJsonObject();
|
||||
JsonObject object = JsonParser.parseString(response).getAsJsonObject();
|
||||
JsonObject playersObject = object.get("players").getAsJsonObject();
|
||||
int online = playersObject.get("online").getAsInt();
|
||||
int max = playersObject.get("max").getAsInt();
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
import java.util.UUID;
|
||||
|
||||
public class YggdrasilMinecraftSessionService extends BaseMinecraftSessionService {
|
||||
public static final JsonParser JSON_PARSER = new JsonParser();
|
||||
public static final boolean NO_TEXTURES = Boolean.parseBoolean("launcher.com.mojang.authlib.noTextures");
|
||||
|
||||
public static void fillTextureProperties(GameProfile profile, PlayerProfile pp) {
|
||||
|
@ -62,7 +61,7 @@ private static void getTexturesMojang(Map<MinecraftProfileTexture.Type, Minecraf
|
|||
JsonObject texturesJSON;
|
||||
try {
|
||||
byte[] decoded = Base64.getDecoder().decode(texturesBase64);
|
||||
texturesJSON = JSON_PARSER.parse(new String(decoded, IOHelper.UNICODE_CHARSET)).getAsJsonObject().getAsJsonObject("textures");
|
||||
texturesJSON = JsonParser.parseString(new String(decoded, IOHelper.UNICODE_CHARSET)).getAsJsonObject().getAsJsonObject("textures");
|
||||
} catch (Exception ignored) {
|
||||
LogHelper.error("Could not decode textures payload, Username: '%s', UUID: '%s'", profile.getName(), profile.getUUID());
|
||||
return;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
public final class HTTPRequest {
|
||||
private static final int TIMEOUT = 10000;
|
||||
private static final JsonParser parser = new JsonParser();
|
||||
|
||||
public static JsonElement jsonRequest(JsonElement request, URL url) throws IOException {
|
||||
return jsonRequest(request, "POST", url);
|
||||
|
@ -42,7 +41,7 @@ public static JsonElement jsonRequest(JsonElement request, String method, URL ur
|
|||
else
|
||||
reader = new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8);
|
||||
try {
|
||||
return parser.parse(reader);
|
||||
return JsonParser.parseReader(reader);
|
||||
} catch (Exception e) {
|
||||
if (200 > statusCode || statusCode > 300) {
|
||||
LogHelper.error("JsonRequest failed. Server response code %d", statusCode);
|
||||
|
|
Loading…
Reference in a new issue