[REFACTOR] Удалены все Depcreated.

This commit is contained in:
Zaxar163 2020-04-04 10:28:15 +03:00
parent 77c797f906
commit 0bda3a9dbd
7 changed files with 8 additions and 12 deletions

1
.gitignore vendored
View file

@ -109,3 +109,4 @@ cmd.bat
cmd.sh
## PVS Studio
.PVS-Studio/
project/target

View file

@ -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);

View file

@ -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

View file

@ -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();

View file

@ -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;

View file

@ -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);

@ -1 +1 @@
Subproject commit 8c4b91f58aafc093eebc3bf0ab9e65989d23f9e3
Subproject commit b1915a27c9adada066d5a1415cf2271fe255e869