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