Permalink
Browse files

#301 - Start using Alex skin and don't show error dialog when skin f…

…ailed to download when user has none set
1 parent 7567754 commit 4a9dd4b51a734178abbf16c1d013c8ebcff71678 @RyanTheAllmighty RyanTheAllmighty committed Jan 4, 2017
Showing with 38 additions and 21 deletions.
  1. +3 −3 CHANGELOG.md
  2. +1 −1 pom.xml
  3. +33 −16 src/main/java/com/atlauncher/data/Account.java
  4. +1 −1 src/main/java/com/atlauncher/data/Constants.java
View
@@ -1,5 +1,5 @@
# Changelog
-## 3.2.3.6
-- Fix NPE when trying to edit mods for an instance
-- Fix some content not being relocalized when language is changed
+## 3.2.4.0
+- Add in Alex default skins for even UUID's
+- Stop showing error dialog when no skin is set by the user and is using default
View
@@ -6,7 +6,7 @@
<groupId>com.atlauncher</groupId>
<artifactId>atlauncher</artifactId>
<name>ATLauncher</name>
- <version>3.2.3.6</version>
+ <version>3.2.4.0</version>
<organization>
<name>ATLauncher</name>
<url>http://www.github.com/ATLauncher/</url>
@@ -177,7 +177,7 @@ public ImageIcon getMinecraftHead() {
File file = null;
if (this.isReal()) {
file = new File(App.settings.getSkinsDir(), (this.isUUIDNull() ? "default" : this.getUUIDNoDashes()) +
- ".png");
+ ".png");
if (!file.exists()) {
this.updateSkin(); // Download/update the users skin
}
@@ -445,17 +445,26 @@ public void updateSkin() {
final File file = new File(App.settings.getSkinsDir(), this.getUUIDNoDashes() + ".png");
LogManager.info("Downloading skin for " + this.minecraftUsername);
final ProgressDialog dialog = new ProgressDialog(Language.INSTANCE.localize("account" + "" +
- ".downloadingskin"), 0, Language.INSTANCE.localizeWithReplace("account.downloadingminecraftskin",
- this.minecraftUsername), "Aborting downloading Minecraft skin for " + this.minecraftUsername);
+ ".downloadingskin"), 0, Language.INSTANCE.localizeWithReplace("account.downloadingminecraftskin",
+ this.minecraftUsername), "Aborting downloading Minecraft skin for " + this.minecraftUsername);
+ final UUID uid = this.getRealUUID();
dialog.addThread(new Thread() {
public void run() {
dialog.setReturnValue(false);
String skinURL = getSkinURL();
if (skinURL == null) {
- LogManager.error("Couldn't download skin because the url found was NULL");
+ LogManager.warn("Couldn't download skin because the url found was NULL. Using default skin");
if (!file.exists()) {
+ String skinFilename = "default.png";
+
+ // even UUID's use the alex skin
+ if ((uid.hashCode() & 1) != 0) {
+ skinFilename = "default_alex.png";
+ }
+
// Only copy over the default skin if there is no skin for the user
- Utils.copyFile(new File(App.settings.getSkinsDir(), "default.png"), file, true);
+ Utils.copyFile(new File(App.settings.getSkinsDir(), skinFilename), file, true);
+ dialog.setReturnValue(true);
}
} else {
try {
@@ -469,8 +478,16 @@ public void run() {
dialog.setReturnValue(true);
} else {
if (!file.exists()) {
+ String skinFilename = "default.png";
+
+ // even UUID's use the alex skin
+ if ((uid.hashCode() & 1) != 0) {
+ skinFilename = "default_alex.png";
+ }
+
// Only copy over the default skin if there is no skin for the user
- Utils.copyFile(new File(App.settings.getSkinsDir(), "default.png"), file, true);
+ Utils.copyFile(new File(App.settings.getSkinsDir(), skinFilename), file, true);
+ dialog.setReturnValue(true);
}
}
} catch (MalformedURLException e) {
@@ -487,8 +504,8 @@ public void run() {
if (!(Boolean) dialog.getReturnValue()) {
String[] options = {Language.INSTANCE.localize("common.ok")};
JOptionPane.showOptionDialog(App.settings.getParent(), Language.INSTANCE.localize("account" + "" +
- ".skinerror"), Language.INSTANCE.localize("common.error"), JOptionPane
- .DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]);
+ ".skinerror"), Language.INSTANCE.localize("common.error"), JOptionPane
+ .DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]);
}
this.skinUpdating = false;
}
@@ -580,10 +597,10 @@ public String toString() {
public String getSession(LoginResponse response) {
if (!response.isOffline() && response != null && response.getAuth().isLoggedIn() && response.getAuth()
- .canPlayOnline()) {
+ .canPlayOnline()) {
if (response.getAuth() instanceof YggdrasilUserAuthentication) {
return String.format("token:%s:%s", response.getAuth().getAuthenticatedToken(), UUIDTypeAdapter
- .fromUUID(response.getAuth().getSelectedProfile().getId()));
+ .fromUUID(response.getAuth().getSelectedProfile().getId()));
} else {
return response.getAuth().getAuthenticatedToken();
}
@@ -624,13 +641,13 @@ public LoginResponse login() {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
JLabel passwordLabel = new JLabel(Language.INSTANCE.localizeWithReplace("instance.enterpassword",
- this.getMinecraftUsername()));
+ this.getMinecraftUsername()));
JPasswordField passwordField = new JPasswordField();
panel.add(passwordLabel, BorderLayout.NORTH);
panel.add(passwordField, BorderLayout.CENTER);
int ret = JOptionPane.showConfirmDialog(App.settings.getParent(), panel, Language.INSTANCE.localize
- ("instance.enterpasswordtitle"), JOptionPane.OK_CANCEL_OPTION);
+ ("instance.enterpasswordtitle"), JOptionPane.OK_CANCEL_OPTION);
if (ret == JOptionPane.OK_OPTION) {
this.setPassword(new String(passwordField.getPassword()));
} else {
@@ -647,9 +664,9 @@ public LoginResponse login() {
LogManager.error(response.getErrorMessage());
String[] options = {Language.INSTANCE.localize("common.ok")};
JOptionPane.showOptionDialog(App.settings.getParent(), HTMLUtils.centerParagraph(Language.INSTANCE
- .localizeWithReplace("instance.errorloggingin", "<br/><br/>" + response.getErrorMessage())),
- Language.INSTANCE.localize("instance" + ".errorloggingintitle"), JOptionPane.DEFAULT_OPTION,
- JOptionPane.ERROR_MESSAGE, null, options, options[0]);
+ .localizeWithReplace("instance.errorloggingin", "<br/><br/>" + response.getErrorMessage())),
+ Language.INSTANCE.localize("instance" + ".errorloggingintitle"), JOptionPane.DEFAULT_OPTION,
+ JOptionPane.ERROR_MESSAGE, null, options, options[0]);
App.settings.setMinecraftLaunched(false);
return null;
}
@@ -682,7 +699,7 @@ public boolean checkForUsernameChange() {
if (!currentUsername.equals(this.minecraftUsername)) {
LogManager.info("The username for account with UUID of " + this.getUUIDNoDashes() + " changed from " +
- this.minecraftUsername + " to " + currentUsername);
+ this.minecraftUsername + " to " + currentUsername);
this.minecraftUsername = currentUsername;
return true;
}
@@ -18,7 +18,7 @@
package com.atlauncher.data;
public class Constants {
- public static final LauncherVersion VERSION = new LauncherVersion(3, 2, 3, 6);
+ public static final LauncherVersion VERSION = new LauncherVersion(3, 2, 4, 0);
public static final String LAUNCHER_NAME = "ATLauncher";
public static final String API_BASE_URL = "https://api.atlauncher.com/v1/launcher/";
public static final String PASTE_CHECK_URL = "http://paste.atlauncher.com";

0 comments on commit 4a9dd4b

Please sign in to comment.