mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-11 21:06:37 -04:00
Fixed lots of bugs
This commit is contained in:
parent
d0c8a95f57
commit
69eaa04ff6
@ -119,7 +119,6 @@ public final class Main implements Runnable {
|
||||
public static void main(String[] args) throws IOException {
|
||||
{
|
||||
//PluginManager.getServerPlugin();
|
||||
|
||||
if (IUpgrader.NOW_UPGRADER.parseArguments(getVersionNumber(), args))
|
||||
return;
|
||||
|
||||
@ -169,6 +168,8 @@ public final class Main implements Runnable {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (true)
|
||||
throw new IOException("???");
|
||||
|
||||
try {
|
||||
PluginManager.plugin().showUI();
|
||||
|
@ -78,6 +78,8 @@ public final class YggdrasilAuthenticator extends IAuthenticator {
|
||||
username = JOptionPane.showInputDialog(C.i18n("login.no_charactor"));
|
||||
else
|
||||
username = selectedProfile.name;
|
||||
if (username == null)
|
||||
throw new AuthenticationException("No player");
|
||||
result.setUserName(username);
|
||||
result.setUserId(selectedProfile == null ? OfflineAuthenticator.getUUIDFromUserName(username) : UUIDTypeAdapter.fromUUID(selectedProfile.id));
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import com.google.gson.JsonSyntaxException;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
@ -93,13 +92,15 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
|
||||
MinecraftVersion mv;
|
||||
try {
|
||||
mv = C.GSON.fromJson(FileUtils.readFileToStringQuietly(mvt), MinecraftVersion.class);
|
||||
if (mv == null)
|
||||
throw new JsonSyntaxException("incorrect version");
|
||||
} catch (JsonSyntaxException ex) {
|
||||
HMCLog.err("Failed to parse minecraft version json.", ex);
|
||||
onFailed(k);
|
||||
return;
|
||||
}
|
||||
String jarURL = vurl + id + ".jar", hash = null;
|
||||
if (service.getDownloadType().getProvider().isAllowedToUseSelfURL() && mv.downloads != null) {
|
||||
if (mv != null && mv.downloads != null && service.getDownloadType().getProvider().isAllowedToUseSelfURL()) {
|
||||
GameDownloadInfo gdi = mv.downloads.get("client");
|
||||
if (gdi != null) {
|
||||
if (gdi.url != null)
|
||||
|
@ -77,6 +77,8 @@ public class MinecraftModService extends IMinecraftModService {
|
||||
try {
|
||||
if (!ModInfo.isFileMod(f))
|
||||
return false;
|
||||
if (!modCache.containsKey(id))
|
||||
recacheMods(id);
|
||||
File modsFolder = service.version().getRunDirectory(id, "mods");
|
||||
if (!modsFolder.exists() && !modsFolder.mkdirs())
|
||||
HMCLog.warn("Failed to make directories: " + modsFolder);
|
||||
|
@ -115,7 +115,7 @@ public class MinecraftVersionManager extends IMinecraftProvider {
|
||||
mcVersion = C.GSON.fromJson(FileUtils.readFileToString(jsonFile), MinecraftVersion.class);
|
||||
if (mcVersion == null)
|
||||
throw new GameException("Wrong json format, got null.");
|
||||
} catch (IOException | GameException e) {
|
||||
} catch (Exception e) {
|
||||
HMCLog.warn("Found wrong format json, try to fix it.", e);
|
||||
if (MessageBox.Show(C.i18n("launcher.versions_json_not_formatted", id), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) {
|
||||
service.download().downloadMinecraftVersionJson(id);
|
||||
@ -190,6 +190,7 @@ public class MinecraftVersionManager extends IMinecraftProvider {
|
||||
|
||||
@Override
|
||||
public File getRunDirectory(String id) {
|
||||
if (getVersionById(id) != null)
|
||||
if ("version".equals(getVersionById(id).runDir))
|
||||
return versionRoot(id);
|
||||
return baseDirectory();
|
||||
|
@ -504,8 +504,10 @@ public class MainPagePanel extends AnimatedPanel {
|
||||
final Consumer<String> versionChanged = this::versionChanged;
|
||||
|
||||
void versionChanged(String selectedVersion) {
|
||||
isLoading = true;
|
||||
((DefaultComboBoxModel) cboVersions.getModel()).setSelectedItem(selectedVersion);
|
||||
cboVersions.setToolTipText(selectedVersion);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
final Consumer<Profile> onSelectedProfilesChanged = t -> {
|
||||
|
@ -101,6 +101,9 @@ public class AppDataUpgrader extends IUpgrader {
|
||||
@Override
|
||||
public boolean call(Object sender, final VersionNumber number) {
|
||||
((UpdateChecker) sender).requestDownloadLink().reg(map -> {
|
||||
if (MessageBox.Show(C.i18n("update.newest_version") + number.firstVer + "." + number.secondVer + "." + number.thirdVer + "\n"
|
||||
+ C.i18n("update.should_open_link"),
|
||||
MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION)
|
||||
if (map != null && map.containsKey("pack"))
|
||||
try {
|
||||
String hash = null;
|
||||
@ -113,9 +116,7 @@ public class AppDataUpgrader extends IUpgrader {
|
||||
} catch (IOException ex) {
|
||||
HMCLog.err("Failed to create upgrader", ex);
|
||||
}
|
||||
if (MessageBox.Show(C.i18n("update.newest_version") + number.firstVer + "." + number.secondVer + "." + number.thirdVer + "\n"
|
||||
+ C.i18n("update.should_open_link"),
|
||||
MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) {
|
||||
else {
|
||||
String url = C.URL_PUBLISH;
|
||||
if (map != null)
|
||||
if (map.containsKey(OS.os().checked_name))
|
||||
|
Loading…
x
Reference in New Issue
Block a user