Move delayed executor and file tree system
This commit is contained in:
parent
b92a261c2c
commit
453d5642b7
5 changed files with 57 additions and 2 deletions
|
@ -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
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<File> getListOfFiles(Path files)
|
||||
{
|
||||
List<File> fileList = new ArrayList<>();
|
||||
|
||||
File[] entries = files.toFile().listFiles();
|
||||
|
||||
for (File file : entries) {
|
||||
fileList.add(file);
|
||||
}
|
||||
return fileList;
|
||||
}
|
||||
}
|
|
@ -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/
|
||||
|
|
Reference in a new issue