Skip to content

Commit ffe7bc9

Browse files
502yCopilot
andauthored
Apply suggestions from code review
AI is so great Co-authored-by: Copilot <[email protected]>
1 parent 6d59f3a commit ffe7bc9

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

src/main/java/i18nupdatemod/I18nUpdateMod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static void init(Path minecraftPath, String minecraftVersion, String load
105105

106106
//Apply resource pack
107107
LoadDetailUI.setStage(LoadStage.APPLY_RESOURCE_PACK);
108-
if (shouldShutdown){
108+
if (shouldShutdown) {
109109
return;
110110
}
111111
GameConfig config = new GameConfig(minecraftPath.resolve("options.txt"));

src/main/java/i18nupdatemod/core/I18nConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static GameAssetDetail getAssetDetail(String minecraftVersion, String loa
6262
LoadDetailUI.appendLog("正在获取最快的镜像源...");
6363
String assetRoot = getFastestUrl();
6464
Log.debug("Using asset root: " + assetRoot);
65-
LoadDetailUI.appendLog("即将从"+assetRoot+"下载资源包");
65+
LoadDetailUI.appendLog("即将从 " + assetRoot + " 下载资源包");
6666

6767
if (assetRoot.equals("https://raw.githubusercontent.com/")) {
6868
ret.downloads = createDownloadDetailsFromGit(convert, loader);

src/main/java/i18nupdatemod/core/LoadDetailUI.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ public void windowClosing(WindowEvent e) {
5656

5757
// 状态栏
5858
statusBar = new JProgressBar();
59-
statusBar.setString("正在合并资源包");
59+
statusBar.setString(LoadStage.getDescription(LoadStage.INIT));
6060
statusBar.setStringPainted(true);
6161
statusBar.setMaximum(LoadStage.values().length - 1);
62-
statusBar.setValue(100);
62+
statusBar.setValue(0);
6363
statusBar.setForeground(new Color(102, 255, 102));
6464
panel.add(statusBar);
6565
panel.add(Box.createVerticalStrut(10));
@@ -106,15 +106,15 @@ public static void show() {
106106
if (!gui.useGUI || gui.frame == null) {
107107
return;
108108
}
109-
gui.frame.setVisible(true);
109+
SwingUtilities.invokeLater(() -> gui.frame.setVisible(true));
110110
}
111111

112112
public static void hide() {
113113
LoadDetailUI gui = getInstance();
114114
if (!gui.useGUI || gui.frame == null) {
115115
return;
116116
}
117-
gui.frame.setVisible(false);
117+
SwingUtilities.invokeLater(() -> gui.frame.setVisible(false));
118118
}
119119

120120
private void shutdown(){

src/main/java/i18nupdatemod/core/ResourcePack.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public ResourcePack(String filename, boolean saveToGame) {
4141

4242
public void checkUpdate(String fileUrl, String md5Url) throws IOException, URISyntaxException, NoSuchAlgorithmException {
4343
if (isUpToDate(md5Url)) {
44-
LoadDetailUI.appendLog(filename + "无需更新");
44+
LoadDetailUI.appendLog(filename + " 无需更新");
4545
Log.debug("Already up to date.");
4646
return;
4747
}
4848
//In this time, we can only download full file
49-
LoadDetailUI.appendLog("正在下载" + filename);
49+
LoadDetailUI.appendLog("正在下载 " + filename);
5050
downloadFull(fileUrl, md5Url);
51-
LoadDetailUI.appendLog(filename + "下载完成");
51+
LoadDetailUI.appendLog(filename + " 下载完成");
5252
//In the future, we will download patch file and merge local file
5353
}
5454

src/main/java/i18nupdatemod/core/ResourcePackConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void convert(int packFormat, String description) throws Exception {
4040
// zos.setMethod(ZipOutputStream.STORED);
4141
for (Path p : sourcePath) {
4242
Log.info("Converting: " + p);
43-
LoadDetailUI.appendLog("正在转换" + p);
43+
LoadDetailUI.appendLog("正在转换 " + p);
4444
try (ZipFile zf = new ZipFile(p.toFile(), StandardCharsets.UTF_8)) {
4545
for (Enumeration<? extends ZipEntry> e = zf.entries(); e.hasMoreElements(); ) {
4646
ZipEntry ze = e.nextElement();

src/main/java/i18nupdatemod/entity/LoadStage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package i18nupdatemod.entity;
22

3-
public enum LoadStage{
3+
public enum LoadStage {
44
INIT(0),
55
DOWNLOAD_ASSET(1),
66
CONVERT_RESOURCE_PACK(2),
@@ -18,7 +18,7 @@ public int getValue() {
1818
}
1919

2020
public static String getDescription(LoadStage stage) {
21-
switch (stage){
21+
switch (stage) {
2222
case INIT:
2323
return "初始化";
2424
case DOWNLOAD_ASSET:

0 commit comments

Comments
 (0)