Stop hotloading production worlds

This commit is contained in:
DanLT 2021-09-02 11:59:12 -08:00
parent bac66dfbf9
commit 923a42e9a3

View File

@ -93,7 +93,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
this.dimensionKey = dimensionKey; this.dimensionKey = dimensionKey;
this.folder = new ReactiveFolder(dataLocation, (_a, _b, _c) -> hotload()); this.folder = new ReactiveFolder(dataLocation, (_a, _b, _c) -> hotload());
setupEngine(); setupEngine();
this.hotloader = new Looper() { this.hotloader = studio ? new Looper() {
@Override @Override
protected long loop() { protected long loop() {
if (hotloadChecker.flip()) { if (hotloadChecker.flip()) {
@ -102,11 +102,15 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
return 250; return 250;
} }
}; } : null;
if(studio)
{
hotloader.setPriority(Thread.MIN_PRIORITY); hotloader.setPriority(Thread.MIN_PRIORITY);
hotloader.start(); hotloader.start();
hotloader.setName(getTarget().getWorld().name() + " Hotloader"); hotloader.setName(getTarget().getWorld().name() + " Hotloader");
} }
}
private void setupEngine() { private void setupEngine() {
IrisData data = IrisData.get(dataLocation); IrisData data = IrisData.get(dataLocation);
@ -232,7 +236,11 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@Override @Override
public void close() { public void close() {
withExclusiveControl(() -> { withExclusiveControl(() -> {
if(isStudio())
{
hotloader.interrupt(); hotloader.interrupt();
}
getEngine().close(); getEngine().close();
}); });
} }
@ -244,6 +252,11 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@Override @Override
public void hotload() { public void hotload() {
if(!isStudio())
{
return;
}
withExclusiveControl(() -> getEngine().hotload()); withExclusiveControl(() -> getEngine().hotload());
} }