mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Hotload datapacks on hotload (still needs restart)
This commit is contained in:
parent
2624315bd5
commit
695c4159dc
@ -82,11 +82,8 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
installDataPacks();
|
installDataPacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void installDataPacks() {
|
public File getDatapacksFolder()
|
||||||
Iris.info("Checking Data Packs...");
|
{
|
||||||
boolean reboot = false;
|
|
||||||
File packs = new File("plugins/Iris/packs");
|
|
||||||
File dpacks = null;
|
|
||||||
File props = new File("server.properties");
|
File props = new File("server.properties");
|
||||||
|
|
||||||
if (props.exists()) {
|
if (props.exists()) {
|
||||||
@ -95,8 +92,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
|
|
||||||
for (String i : m) {
|
for (String i : m) {
|
||||||
if (i.trim().startsWith("level-name=")) {
|
if (i.trim().startsWith("level-name=")) {
|
||||||
dpacks = new File(i.trim().split("\\Q=\\E")[1] + "/datapacks");
|
return new File(i.trim().split("\\Q=\\E")[1] + "/datapacks");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -105,12 +101,20 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void installDataPacks() {
|
||||||
|
Iris.info("Checking Data Packs...");
|
||||||
|
boolean reboot = false;
|
||||||
|
File packs = new File("plugins/Iris/packs");
|
||||||
|
File dpacks = getDatapacksFolder();
|
||||||
|
|
||||||
if (dpacks == null) {
|
if (dpacks == null) {
|
||||||
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (packs.exists()) {
|
if (packs.exists()) {
|
||||||
for (File i : packs.listFiles()) {
|
for (File i : packs.listFiles()) {
|
||||||
if (i.isDirectory()) {
|
if (i.isDirectory()) {
|
||||||
|
@ -107,7 +107,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
try {
|
try {
|
||||||
for (Player i : getTarget().getWorld().getPlayers()) {
|
for (Player i : getTarget().getWorld().getPlayers()) {
|
||||||
new MortarSender(i, Iris.instance.getTag()).sendMessage("Dimension Hotloaded");
|
new MortarSender(i, Iris.instance.getTag()).sendMessage("Dimension Hotloaded");
|
||||||
i.playSound(i.getLocation(), Sound.ITEM_BOTTLE_FILL, 1f, 1.25f);
|
i.playSound(i.getLocation(), Sound.BLOCK_BEACON_ACTIVATE, 1f, 1.25f);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {Iris.reportError(e);
|
} catch (Throwable e) {Iris.reportError(e);
|
||||||
|
|
||||||
@ -306,6 +306,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
populators.clear();
|
populators.clear();
|
||||||
populators.addAll(compound.getPopulators());
|
populators.addAll(compound.getPopulators());
|
||||||
hotloader = new ReactiveFolder(data.getDataFolder(), (a, c, d) -> hotload());
|
hotloader = new ReactiveFolder(data.getDataFolder(), (a, c, d) -> hotload());
|
||||||
|
dim.installDataPack(() -> data, Iris.instance.getDatapacksFolder());
|
||||||
} catch (Throwable e) {Iris.reportError(e);
|
} catch (Throwable e) {Iris.reportError(e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Iris.error("FAILED TO INITIALIZE DIMENSION FROM " + world.toString());
|
Iris.error("FAILED TO INITIALIZE DIMENSION FROM " + world.toString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user