Fixed ClassCastException

This commit is contained in:
huangyuhui
2016-04-05 22:16:29 +08:00
parent 4a2ac63d25
commit 16152de39d
5 changed files with 69 additions and 83 deletions

View File

@@ -96,7 +96,8 @@ public abstract class IAuthenticator {
public void onLoadSettings(Map m) {
if (m == null)
return;
username = (String) m.get("IAuthenticator_UserName");
Object o = m.get("IAuthenticator_UserName");
username = o instanceof String ? (String) o : "";
}
public String getUserName() {

View File

@@ -64,7 +64,7 @@ public class MojangDownloadProvider extends IDownloadProvider {
@Override
public String getAssetsDownloadURL() {
return "http://resources.download.minecraft.net/";
return "https://resources.download.minecraft.net/";
}
@Override

View File

@@ -52,10 +52,10 @@ import org.jackhuang.hellominecraft.util.ui.GraphicsUtils;
import org.jackhuang.hellominecraft.lookandfeel.Theme;
import org.jackhuang.hellominecraft.util.MessageBox;
import org.jackhuang.hellominecraft.util.StrUtils;
import org.jackhuang.hellominecraft.util.Utils;
import org.jackhuang.hellominecraft.util.ui.DropShadowBorder;
import org.jackhuang.hellominecraft.util.ui.TintablePanel;
import org.jackhuang.hellominecraft.util.ui.BasicColors;
import org.jackhuang.hellominecraft.util.ui.SwingUtils;
/**
*
@@ -168,7 +168,7 @@ public final class MainFrame extends DraggableFrame {
ImageIcon headerIcon = Main.getIcon("icon.png");
this.setIconImage(headerIcon.getImage());
headerIcon = Utils.scaleImage(headerIcon, 16, 16);
headerIcon = SwingUtils.scaleImage(headerIcon, 16, 16);
JLabel headerLabel = new JLabel(headerIcon);
headerLabel.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
header.add(headerLabel);
@@ -318,7 +318,7 @@ public final class MainFrame extends DraggableFrame {
ImageIcon background;
public void loadBackground() {
background = Utils.searchBackgroundImage(Main.getIcon(Settings.getInstance().getTheme().settings.get("Customized.MainFrame.background_image")), Settings.getInstance().getBgpath(), 800, 480);
background = SwingUtils.searchBackgroundImage(Main.getIcon(Settings.getInstance().getTheme().settings.get("Customized.MainFrame.background_image")), Settings.getInstance().getBgpath(), 800, 480);
if (background != null)
if (backgroundLabel == null) {
backgroundLabel = new JLabel(background);