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.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
||||||
@@ -99,6 +100,10 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
|||||||
return dataLoaders.computeIfAbsent(dataFolder, IrisData::new);
|
return dataLoaders.computeIfAbsent(dataFolder, IrisData::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Optional<IrisData> getLoaded(File dataFolder) {
|
||||||
|
return Optional.ofNullable(dataLoaders.get(dataFolder));
|
||||||
|
}
|
||||||
|
|
||||||
public static void dereference() {
|
public static void dereference() {
|
||||||
dataLoaders.v().forEach(IrisData::cleanupEngine);
|
dataLoaders.v().forEach(IrisData::cleanupEngine);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,8 +147,7 @@ public class StudioSVC implements IrisService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IrisData dm = IrisData.get(folder);
|
IrisData dm = IrisData.get(folder);
|
||||||
dm.dump();
|
dm.hotloaded();
|
||||||
dm.clearLists();
|
|
||||||
dim = dm.getDimensionLoader().load(type);
|
dim = dm.getDimensionLoader().load(type);
|
||||||
|
|
||||||
if (dim == null) {
|
if (dim == null) {
|
||||||
@@ -299,7 +298,8 @@ public class StudioSVC implements IrisService {
|
|||||||
packEntry.mkdirs();
|
packEntry.mkdirs();
|
||||||
ZipUtil.unpack(cp, packEntry);
|
ZipUtil.unpack(cp, packEntry);
|
||||||
}
|
}
|
||||||
IrisData.get(packEntry).hotloaded();
|
IrisData.getLoaded(packEntry)
|
||||||
|
.ifPresent(IrisData::hotloaded);
|
||||||
|
|
||||||
sender.sendMessage("Successfully Aquired " + d.getName());
|
sender.sendMessage("Successfully Aquired " + d.getName());
|
||||||
ServerConfigurator.installDataPacks(true);
|
ServerConfigurator.installDataPacks(true);
|
||||||
|
|||||||
@@ -179,6 +179,8 @@ public class IO {
|
|||||||
JsonElement json;
|
JsonElement json;
|
||||||
try (FileReader reader = new FileReader(file)) {
|
try (FileReader reader = new FileReader(file)) {
|
||||||
json = JsonParser.parseReader(reader);
|
json = JsonParser.parseReader(reader);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
throw new IOException("Failed to read json file " + file, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
var queue = new LinkedList<JsonElement>();
|
var queue = new LinkedList<JsonElement>();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ReactiveFolder {
|
|||||||
|
|
||||||
if (checkCycle % 3 == 0 ? fw.checkModified() : fw.checkModifiedFast()) {
|
if (checkCycle % 3 == 0 ? fw.checkModified() : fw.checkModifiedFast()) {
|
||||||
for (File i : fw.getCreated()) {
|
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")) {
|
if (i.getPath().contains(".iris")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ public class ReactiveFolder {
|
|||||||
continue;
|
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;
|
modified = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ public class ReactiveFolder {
|
|||||||
continue;
|
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;
|
modified = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user