diff --git a/src/main/java/com/josyf/commandbuttons/ConfigFile.java b/src/main/java/com/josyf/commandbuttons/ConfigFile.java index dfbb238..ba770f3 100644 --- a/src/main/java/com/josyf/commandbuttons/ConfigFile.java +++ b/src/main/java/com/josyf/commandbuttons/ConfigFile.java @@ -16,9 +16,9 @@ import java.util.List; public class ConfigFile { private static final JSONParser parser = new JSONParser(); - private static final String CONFIG_FILE_NAME = "commands.json"; + private static final String CONFIG_FILE_NAME = "commands1.json"; // 改下名称防止冲突,不过我也不确定会不会有人同时加俩版本 - // Read commands.json, convert it to an array, and append A JSON OBJECT + // Read commands1.json, convert it to an array, and append A JSON OBJECT public static void appendToFile(JSONObject jsonObject) { JSONArray array = getJsonArrayFromFile(); if (array == null) { @@ -78,7 +78,7 @@ public class ConfigFile { } - // overwrites current commands.json w/ updated jsonArray + // overwrites current commands1.json w/ updated jsonArray private static void writeToFile(JSONArray jsonArray) { FileWriter fileWriter = null; try { @@ -101,7 +101,7 @@ public class ConfigFile { } } - // parses commands.json into JSONArray + // parses commands1.json into JSONArray private static JSONArray getJsonArrayFromFile() { try (FileReader reader = new FileReader(CONFIG_FILE_NAME)) { Object obj = parser.parse(reader); @@ -116,17 +116,17 @@ public class ConfigFile { return new JSONArray(); } } catch (IOException e) { - System.out.println("Commands.json文件不存在或读取错误。返回null。"); + System.out.println("commands1.json文件不存在或读取错误。返回null。"); return null; } catch (ParseException e) { - System.err.println("解析 commands.json 时出错:" + e.getMessage()); + System.err.println("解析 commands1.json 时出错:" + e.getMessage()); e.printStackTrace(); return new JSONArray(); } } - // parses commands.json into + // parses commands1.json into public static ArrayList getArrayFromJsonFile() { JSONArray array = getJsonArrayFromFile(); if (array == null) { diff --git a/src/main/java/com/josyf/commandbuttons/gui/ButtonGUI.java b/src/main/java/com/josyf/commandbuttons/gui/ButtonGUI.java index 63467b1..bf74602 100644 --- a/src/main/java/com/josyf/commandbuttons/gui/ButtonGUI.java +++ b/src/main/java/com/josyf/commandbuttons/gui/ButtonGUI.java @@ -97,7 +97,7 @@ public class ButtonGUI extends LightweightGuiDescription { commandListPanel.add(commandEntryPanel, 0, yOffset, 18, 1); yOffset += 1; } else { - System.err.println("在 commands.json 中跳过格式错误的命令对象:" + object.toJSONString()); + System.err.println("在 commands1.json 中跳过格式错误的命令对象:" + object.toJSONString()); } } }