mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-19 15:09:18 +00:00
fix hotloading when changing kts
This commit is contained in:
@@ -51,6 +51,7 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
@Data
|
||||
public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
||||
@@ -99,6 +100,10 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
||||
return dataLoaders.computeIfAbsent(dataFolder, IrisData::new);
|
||||
}
|
||||
|
||||
public static Optional<IrisData> getLoaded(File dataFolder) {
|
||||
return Optional.ofNullable(dataLoaders.get(dataFolder));
|
||||
}
|
||||
|
||||
public static void dereference() {
|
||||
dataLoaders.v().forEach(IrisData::cleanupEngine);
|
||||
}
|
||||
|
||||
@@ -147,8 +147,7 @@ public class StudioSVC implements IrisService {
|
||||
}
|
||||
|
||||
IrisData dm = IrisData.get(folder);
|
||||
dm.dump();
|
||||
dm.clearLists();
|
||||
dm.hotloaded();
|
||||
dim = dm.getDimensionLoader().load(type);
|
||||
|
||||
if (dim == null) {
|
||||
@@ -299,7 +298,8 @@ public class StudioSVC implements IrisService {
|
||||
packEntry.mkdirs();
|
||||
ZipUtil.unpack(cp, packEntry);
|
||||
}
|
||||
IrisData.get(packEntry).hotloaded();
|
||||
IrisData.getLoaded(packEntry)
|
||||
.ifPresent(IrisData::hotloaded);
|
||||
|
||||
sender.sendMessage("Successfully Aquired " + d.getName());
|
||||
ServerConfigurator.installDataPacks(true);
|
||||
|
||||
@@ -179,6 +179,8 @@ public class IO {
|
||||
JsonElement json;
|
||||
try (FileReader reader = new FileReader(file)) {
|
||||
json = JsonParser.parseReader(reader);
|
||||
} catch (Throwable e) {
|
||||
throw new IOException("Failed to read json file " + file, e);
|
||||
}
|
||||
|
||||
var queue = new LinkedList<JsonElement>();
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ReactiveFolder {
|
||||
|
||||
if (checkCycle % 3 == 0 ? fw.checkModified() : fw.checkModifiedFast()) {
|
||||
for (File i : fw.getCreated()) {
|
||||
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".js")) {
|
||||
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".kts")) {
|
||||
if (i.getPath().contains(".iris")) {
|
||||
continue;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class ReactiveFolder {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".js")) {
|
||||
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".kts")) {
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class ReactiveFolder {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".js")) {
|
||||
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".kts")) {
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user