Compare commits

..

No commits in common. "e91d618dd65811a206ae6fa09a447ce59fcde0f2" and "7fe598539118a0d21290781c413a17f7d434c186" have entirely different histories.

2 changed files with 8 additions and 11 deletions

View file

@ -72,6 +72,7 @@ public class FavoriteAddItem {
final List<Appearance> favorites = profile.getFavorites();
favorites.add(profile.getAppearance());
profile.setFavorites(favorites);
dataStore.updateCache(player.getUniqueId(), profile);
new FavoritesGUI(player).open();
return true;

View file

@ -105,17 +105,13 @@ public class MojangAPI {
private JsonObject getRequestToUrl(String parametrizedUrl) throws ExecutionException, InterruptedException {
return worker.submit(() -> {
final URL url = URI.create(parametrizedUrl).toURL();
final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
final HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setDoInput(true);
con.setRequestMethod("GET");
connection.setDoInput(true);
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0");
connection.setRequestMethod("GET");
switch (connection.getResponseCode()) {
switch (con.getResponseCode()) {
case 403:
logger.warning("The Mojang API denied the request. This should not happen.");
logger.warning("Nicko is NOT responsible for this error. Try again in a few minutes or hours.");
logger.warning("See https://bugs.mojang.com/browse/WEB/issues/WEB-7591 for more info.");
logger.warning("Failed to parse request: forbidden?");
return getErrorObject();
case 404:
case 400:
@ -125,7 +121,7 @@ public class MojangAPI {
logger.warning("Failed to parse request: The connection is throttled.");
return getErrorObject();
case 200:
final BufferedReader input = new BufferedReader(new InputStreamReader(connection.getInputStream()));
final BufferedReader input = new BufferedReader(new InputStreamReader(con.getInputStream()));
final StringBuilder builder = new StringBuilder();
String line;
while ((line = input.readLine()) != null) {
@ -140,7 +136,7 @@ public class MojangAPI {
return getErrorObject();
}
default:
logger.warning("Unhandled response code from Mojang: " + connection.getResponseCode());
logger.warning("Unhandled response code from Mojang: " + con.getResponseCode());
return getErrorObject();
}
}).get();