Skip to content

Commit

Permalink
final 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinhong11 committed Feb 3, 2024
1 parent d841d8a commit 3f9f7a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>*.zip</exclude>
<exclude>/**/*.zip</exclude>
</excludes>
</resource>
</resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,8 @@ public static void saveExample() {
INSTANCE.saveResource(head + "items.yml", false);
INSTANCE.saveResource(head + "generators.yml", false);
INSTANCE.saveResource(head + "mat_generators.yml", false);
INSTANCE.saveResource(head + "scripts/example_item_2.js", false);
INSTANCE.saveResource(head + "scripts/example_machine.js", false);
INSTANCE.saveResource(head + "scripts/example_machine_energy.js", false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,19 @@ public static ItemStack readItem(ConfigurationSection section, boolean countable

@SuppressWarnings("deprecation")
public static void saveItem(ItemStack item, String fileName, ProjectAddon addon) {
File file = new File(addon.getSavedItemsFolder(), fileName + ".yml");
File folder = addon.getSavedItemsFolder();
if (!folder.exists()) {
folder.mkdirs();
}
File file = new File(folder, fileName + ".yml");
if (!file.exists()) {
try {file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
return;
}
}

YamlConfiguration configuration = YamlConfiguration.loadConfiguration(file);
ItemStack stack = item.clone();
ItemMeta meta = stack.getItemMeta();
Expand Down

0 comments on commit 3f9f7a4

Please sign in to comment.