mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2024-12-27 07:10:41 +08:00
Fixed reseting the color at warning mode
This commit is contained in:
parent
a0b19cfd1b
commit
caa77387df
@ -310,7 +310,6 @@ public class VersionSetting {
|
||||
x.setFullscreen(isFullscreen());
|
||||
x.setWrapper(getWrapper());
|
||||
x.setGameDir(gameDir);
|
||||
x.setGameDirType(getGameDirType());
|
||||
x.setHeight(getHeight());
|
||||
x.setJavaArgs(getJavaArgs());
|
||||
x.setLaunchVersion(id);
|
||||
|
@ -394,6 +394,8 @@ public final class MainFrame extends DraggableFrame implements IRepaint {
|
||||
}
|
||||
|
||||
public void reloadColor(Theme t) {
|
||||
if (isShowedMessage)
|
||||
return;
|
||||
for (Map.Entry<String, String> entry : t.settings.entrySet()) {
|
||||
if (entry.getValue().startsWith("#"))
|
||||
UIManager.put(entry.getKey(), GraphicsUtils.getWebColor(entry.getValue()));
|
||||
|
@ -402,7 +402,7 @@ public class MainPagePanel extends Page {
|
||||
fc.showOpenDialog(this);
|
||||
if (fc.getSelectedFile() == null)
|
||||
return;
|
||||
String suggestedModpackId = JOptionPane.showInputDialog("Please enter your favourite game name", FileUtils.getBaseName(fc.getSelectedFile().getName()));
|
||||
String suggestedModpackId = JOptionPane.showInputDialog(C.i18n("modpack.enter_name"), FileUtils.getBaseName(fc.getSelectedFile().getName()));
|
||||
TaskWindow.factory().append(ModpackManager.install(MainFrame.INSTANCE, fc.getSelectedFile(), Settings.getLastProfile().service(), suggestedModpackId)).execute();
|
||||
Settings.getLastProfile().service().version().refreshVersions();
|
||||
}//GEN-LAST:event_btnImportModpackActionPerformed
|
||||
|
@ -56,7 +56,7 @@ public class HMCLMinecraftService extends IMinecraftService {
|
||||
public HMCLMinecraftService(Profile p) {
|
||||
this.p = p;
|
||||
this.provider = new HMCLGameProvider(this);
|
||||
provider.initializeMiencraft();
|
||||
provider.initializeMinecraft();
|
||||
HMCLApi.EVENT_BUS.channel(RefreshingVersionsEvent.class).register(versionSettings::clear);
|
||||
HMCLApi.EVENT_BUS.channel(RefreshedVersionsEvent.class).registerFirst(() -> {
|
||||
if (!checkingModpack) {
|
||||
|
@ -29,7 +29,6 @@ public class LaunchOptions {
|
||||
private String proxyHost, proxyPort, proxyUser, proxyPass, javaDir, launchVersion, type, precalledCommand;
|
||||
private boolean fullscreen, noJVMArgs, notCheckGame;
|
||||
private File gameDir;
|
||||
private GameDirType gameDirType;
|
||||
|
||||
public String getVersionName() {
|
||||
return versionName;
|
||||
@ -115,14 +114,6 @@ public class LaunchOptions {
|
||||
this.fullscreen = fullscreen;
|
||||
}
|
||||
|
||||
public GameDirType getGameDirType() {
|
||||
return gameDirType;
|
||||
}
|
||||
|
||||
public void setGameDirType(GameDirType gameDirType) {
|
||||
this.gameDirType = gameDirType;
|
||||
}
|
||||
|
||||
public String getPermSize() {
|
||||
return permSize;
|
||||
}
|
||||
|
@ -120,6 +120,7 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
HMCLog.warn("Failed to make directories: " + assetsDir);
|
||||
File assetsIndex = getIndexFile(assetIndex.getId());
|
||||
File renamed = null;
|
||||
// This is unnecessary to do such backup job, FileDownloadTask can do this.
|
||||
if (assetsIndex.exists()) {
|
||||
renamed = new File(assetsDir, "indexes/" + assetIndex.getId() + "-renamed.json");
|
||||
if (assetsIndex.renameTo(renamed))
|
||||
@ -150,16 +151,16 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
@Override
|
||||
public File getAssetObject(String assetId, String name) throws IOException {
|
||||
try {
|
||||
AssetsIndex index = (AssetsIndex) C.GSON.fromJson(FileUtils.read(getIndexFile(assetId), "UTF-8"), AssetsIndex.class);
|
||||
AssetsIndex index = C.GSON.fromJson(FileUtils.read(getIndexFile(assetId), "UTF-8"), AssetsIndex.class);
|
||||
if (index == null || index.getFileMap() == null || index.getFileMap().get(name) == null)
|
||||
throw new IOException("Assets file format malformed.");
|
||||
return getAssetObject(assetId, (AssetsObject) index.getFileMap().get(name));
|
||||
return getAssetObject(assetId, index.getFileMap().get(name));
|
||||
} catch (JsonSyntaxException e) {
|
||||
throw new IOException("Assets file format malformed.", e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean checkAssetsExistance(AssetIndexDownloadInfo assetIndex, LoggingInfo info) {
|
||||
protected boolean checkAssetsExistence(AssetIndexDownloadInfo assetIndex, LoggingInfo info) {
|
||||
String assetId = assetIndex.getId();
|
||||
File indexFile = getIndexFile(assetId);
|
||||
File assetDir = getAssets(assetId);
|
||||
@ -208,8 +209,8 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
HMCLog.log("Reconstructing virtual assets folder at " + virtualRoot);
|
||||
int tot = index.getFileMap().entrySet().size();
|
||||
for (Map.Entry<String, AssetsObject> entry : index.getFileMap().entrySet()) {
|
||||
File target = new File(virtualRoot, (String) entry.getKey());
|
||||
File original = assetObjectPath(assetsDir, (AssetsObject) entry.getValue());
|
||||
File target = new File(virtualRoot, entry.getKey());
|
||||
File original = assetObjectPath(assetsDir, entry.getValue());
|
||||
if (original.exists()) {
|
||||
cnt++;
|
||||
if (!target.isFile())
|
||||
@ -240,7 +241,7 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
LoggingInfo logging = null;
|
||||
if (t.logging != null)
|
||||
logging = t.logging.get("client");
|
||||
if (allow && !checkAssetsExistance(t.getAssetsIndex(), logging))
|
||||
if (allow && !checkAssetsExistence(t.getAssetsIndex(), logging))
|
||||
if (MessageBox.show(C.i18n("assets.no_assets"), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION)
|
||||
TaskWindow.factory().execute(downloadAssets(t));
|
||||
return reconstructAssets(t.getAssetsIndex()).getAbsolutePath();
|
||||
|
@ -23,7 +23,6 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import org.jackhuang.hmcl.util.C;
|
||||
import org.jackhuang.hmcl.util.net.HTTPGetTask;
|
||||
import org.jackhuang.hmcl.util.net.NetUtils;
|
||||
import org.jackhuang.hmcl.util.task.Task;
|
||||
import org.jackhuang.hmcl.util.task.TaskWorker;
|
||||
|
||||
|
@ -59,7 +59,7 @@ public abstract class InstallerVersionList {
|
||||
*
|
||||
* @return cached result.
|
||||
*/
|
||||
public List<InstallerVersion> getVersionsImpl(String mcVersion) {
|
||||
private List<InstallerVersion> getVersionsImpl(String mcVersion) {
|
||||
if (versions == null || versionMap == null)
|
||||
return null;
|
||||
if (StrUtils.isBlank(mcVersion))
|
||||
|
@ -78,7 +78,6 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
|
||||
MinecraftForgeVersion v = root.number.get(num);
|
||||
InstallerVersion iv = new InstallerVersion(v.version, StrUtils.formatVersion(v.mcversion));
|
||||
for (String[] f : v.files) {
|
||||
|
||||
String ver = v.mcversion + "-" + v.version;
|
||||
if (!StrUtils.isBlank(v.branch))
|
||||
ver = ver + "-" + v.branch;
|
||||
@ -105,7 +104,7 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
|
||||
versions.add(iv);
|
||||
}
|
||||
|
||||
versionMap.put(StrUtils.formatVersion(mcver), al);
|
||||
versionMap.put(mcver, al);
|
||||
}
|
||||
|
||||
Collections.sort(versions, new InstallerVersionComparator());
|
||||
|
@ -177,7 +177,7 @@ public abstract class AbstractMinecraftLoader implements IMinecraftLoader {
|
||||
if (StrUtils.isNotBlank(options.getProxyUser()) && StrUtils.isNotBlank(options.getProxyPass())) {
|
||||
res.add("--proxyUser");
|
||||
res.add(options.getProxyUser());
|
||||
res.add("-=proxyPass");
|
||||
res.add("--proxyPass");
|
||||
res.add(options.getProxyPass());
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public abstract class GameLauncher {
|
||||
boolean isWin = OS.os() == OS.WINDOWS;
|
||||
File f = new File(launcherName + (isWin ? ".bat" : ".sh"));
|
||||
if (!f.exists() && !f.createNewFile())
|
||||
HMCLog.warn("Failed to create " + f);
|
||||
throw new IOException("Script file " + f.getAbsolutePath() + " does not exist but cannot be created.");
|
||||
BufferedWriter writer;
|
||||
try (FileOutputStream fos = FileUtils.openOutputStream(f)) {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(fos, Charsets.toCharset()));
|
||||
|
@ -65,7 +65,7 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
|
||||
}
|
||||
File f = version.getJar(service.baseDirectory());
|
||||
if (!f.exists())
|
||||
throw new GameException("Minecraft jar does not exists");
|
||||
throw new GameException("Minecraft jar does not exist");
|
||||
library.append(f.getAbsolutePath()).append(File.pathSeparator);
|
||||
res.add("-cp");
|
||||
res.add(library.toString().substring(0, library.length() - File.pathSeparator.length()));
|
||||
|
@ -44,7 +44,7 @@ public abstract class IMinecraftProvider<T extends IMinecraftService> {
|
||||
/**
|
||||
* To download mod packs.
|
||||
*/
|
||||
public abstract void initializeMiencraft();
|
||||
public abstract void initializeMinecraft();
|
||||
|
||||
/**
|
||||
* Get the run directory of given version.
|
||||
|
@ -108,7 +108,7 @@ public class MinecraftVersionManager<T extends IMinecraftService> extends IMinec
|
||||
if (ask) {
|
||||
HMCLog.warn("Found not matched filenames version: " + id + ", json: " + jsons[0].getName());
|
||||
if (MessageBox.show(String.format(C.i18n("launcher.versions_json_not_matched"), id, jsons[0].getName()), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION)
|
||||
if (!jsons[0].renameTo(new File(jsons[0].getParent(), id + ".json")))
|
||||
if (!jsons[0].renameTo(jsonFile))
|
||||
HMCLog.warn("Failed to rename version json " + jsons[0]);
|
||||
}
|
||||
if (!jsonFile.exists()) {
|
||||
@ -283,6 +283,7 @@ public class MinecraftVersionManager<T extends IMinecraftService> extends IMinec
|
||||
|
||||
@Override
|
||||
public boolean onLaunch(String id) {
|
||||
// Fix bug in Minecraft 1.8
|
||||
File resourcePacks = new File(getRunDirectory(id), "resourcepacks");
|
||||
if (!FileUtils.makeDirectory(resourcePacks))
|
||||
HMCLog.warn("Failed to make resourcePacks: " + resourcePacks);
|
||||
@ -305,6 +306,6 @@ public class MinecraftVersionManager<T extends IMinecraftService> extends IMinec
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeMiencraft() {
|
||||
public void initializeMinecraft() {
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class TaskList extends Thread {
|
||||
}
|
||||
Invoker thread = new Invoker(t2, counter, bool);
|
||||
invokers.add(thread);
|
||||
if (!EXECUTOR_SERVICE.isShutdown() && !EXECUTOR_SERVICE.isTerminated())
|
||||
if (!EXECUTOR_SERVICE.isShutdown())
|
||||
futures.put(thread, EXECUTOR_SERVICE.submit(thread));
|
||||
}
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user