Read server properties file for proper dpacks folder

This commit is contained in:
Daniel Mills 2021-07-14 14:40:43 -04:00
parent 24aaefe342
commit c05f169d54

View File

@ -71,21 +71,24 @@ public class Iris extends VolmitPlugin implements Listener {
boolean reboot = false; boolean reboot = false;
File packs = new File("plugins/Iris/packs"); File packs = new File("plugins/Iris/packs");
File dpacks = null; File dpacks = null;
File props = new File("server.properties");
look: for(File i : new File(".").listFiles()) if(props.exists())
{ {
if(i.isDirectory()) try {
{ KList<String> m = new KList<>(IO.readAll(props).split("\\Q\n\\E"));
for(File j : i.listFiles())
{ for(String i : m) {
if(j.isDirectory() && j.getName().equals("datapacks")) if (i.trim().startsWith("level-name="))
{ {
dpacks = j; dpacks = new File(i.trim().split("\\Q\\E")[1] + "/datapacks");
break look; break;
} }
} }
} } catch (IOException e) {
} e.printStackTrace();
}
}
if(dpacks == null) if(dpacks == null)
{ {