diff --git a/gradle.properties b/gradle.properties index 99dd296..02d1ca4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,5 +5,5 @@ org.gradle.daemon=false mc_version=1.18.2 forge_version=40.2.1 -myversion=1.0.5.6 +myversion=1.0.5.7 parchment_version=2022.11.06 \ No newline at end of file diff --git a/src/main/java/dev/zontreck/libzontreck/LibZontreck.java b/src/main/java/dev/zontreck/libzontreck/LibZontreck.java index 1ab85ae..76768c3 100644 --- a/src/main/java/dev/zontreck/libzontreck/LibZontreck.java +++ b/src/main/java/dev/zontreck/libzontreck/LibZontreck.java @@ -1,5 +1,8 @@ package dev.zontreck.libzontreck; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -39,9 +42,20 @@ public class LibZontreck { public static VolatilePlayerStorage playerStorage; public static boolean ALIVE; public static final String FILESTORE = FileTreeDatastore.get(); + public static final Path BASE_CONFIG; static{ PROFILES = new HashMap<>(); + BASE_CONFIG = FileTreeDatastore.of("libzontreck"); + + if(!BASE_CONFIG.toFile().exists()) + { + try { + Files.createDirectory(BASE_CONFIG); + } catch (IOException e) { + e.printStackTrace(); + } + } } public LibZontreck(){ diff --git a/src/main/java/dev/zontreck/libzontreck/profiles/Profile.java b/src/main/java/dev/zontreck/libzontreck/profiles/Profile.java index b02e3cd..9612830 100644 --- a/src/main/java/dev/zontreck/libzontreck/profiles/Profile.java +++ b/src/main/java/dev/zontreck/libzontreck/profiles/Profile.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.attribute.FileAttribute; import dev.zontreck.libzontreck.LibZontreck; import dev.zontreck.libzontreck.chat.ChatColor; @@ -28,9 +29,17 @@ public class Profile { private File accessor; - public static final Path BASE = FileTreeDatastore.of("libzontreck").resolve("profiles"); + public static final Path BASE = LibZontreck.BASE_CONFIG.resolve("profiles"); public Profile(String username, String prefix, String nickname, String name_color, String ID, String prefix_color, String chat_color, Boolean isFlying, int vaults, File vaultFile) { + if(!BASE.toFile().exists()) + { + try { + Files.createDirectory(BASE); + } catch (IOException e) { + e.printStackTrace(); + } + } this.username = username; this.prefix = prefix; this.nickname = nickname; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 5863e03..eafebef 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -19,7 +19,7 @@ modId="libzontreck" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata # see the associated build.gradle script for how to populate this completely automatically during a build -version="1.0.5.6" #mandatory +version="1.0.5.7" #mandatory # A display name for the mod displayName="LibZontreck" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/