diff --git a/gradle.properties b/gradle.properties index 57a048b..c953804 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.1 +myversion=1.0.5.2 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 b82ba11..9eb1522 100644 --- a/src/main/java/dev/zontreck/libzontreck/LibZontreck.java +++ b/src/main/java/dev/zontreck/libzontreck/LibZontreck.java @@ -7,6 +7,7 @@ import com.mojang.logging.LogUtils; import dev.zontreck.libzontreck.events.PlayerChangedPositionEvent; import dev.zontreck.libzontreck.memory.PlayerContainer; import dev.zontreck.libzontreck.memory.VolatilePlayerStorage; +import dev.zontreck.libzontreck.util.DelayedExecutorService; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.common.MinecraftForge; @@ -34,6 +35,7 @@ public class LibZontreck { // Register the setup method for modloading bus.addListener(this::setup); + bus.register(DelayedExecutorService.getInstance()); MinecraftForge.EVENT_BUS.register(this); } diff --git a/src/main/java/dev/zontreck/libzontreck/util/DelayedExecutorService.java b/src/main/java/dev/zontreck/libzontreck/util/DelayedExecutorService.java index 1686740..1977c6c 100644 --- a/src/main/java/dev/zontreck/libzontreck/util/DelayedExecutorService.java +++ b/src/main/java/dev/zontreck/libzontreck/util/DelayedExecutorService.java @@ -15,6 +15,15 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber(modid=LibZontreck.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class DelayedExecutorService { private static int COUNT = 0; + private static final DelayedExecutorService inst; + static{ + inst=new DelayedExecutorService(); + } + + public static DelayedExecutorService getInstance() + { + return inst; + } public class DelayedExecution { public DelayedExecution(Runnable run, long unix) { diff --git a/src/main/java/dev/zontreck/libzontreck/util/FileTreeDatastore.java b/src/main/java/dev/zontreck/libzontreck/util/FileTreeDatastore.java new file mode 100644 index 0000000..ae58224 --- /dev/null +++ b/src/main/java/dev/zontreck/libzontreck/util/FileTreeDatastore.java @@ -0,0 +1,44 @@ +package dev.zontreck.libzontreck.util; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +import net.minecraftforge.fml.loading.FMLPaths; + +public class FileTreeDatastore { + private static final Path BASE; + + static{ + Path X = FMLPaths.CONFIGDIR.get().resolve("arias_mods"); + BASE=X; + if(!BASE.toFile().exists()) + { + try { + Files.createDirectory(BASE); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public static Path of(String nick) + { + return BASE.resolve(nick); + } + + public static List getListOfFiles(Path files) + { + List fileList = new ArrayList<>(); + + File[] entries = files.toFile().listFiles(); + + for (File file : entries) { + fileList.add(file); + } + return fileList; + } +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index fa3c8fd..5399500 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.1" #mandatory +version="1.0.5.2" #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/