fix issue with bukkit.yml world-container option

This commit is contained in:
ColorsWind 2023-01-05 15:57:36 +08:00
parent 00aa26e602
commit 497c24a3b6
6 changed files with 8 additions and 7 deletions

View File

@ -684,7 +684,7 @@ public class Iris extends VolmitPlugin implements Listener {
.name(worldName) .name(worldName)
.seed(1337) .seed(1337)
.environment(dim.getEnvironment()) .environment(dim.getEnvironment())
.worldFolder(new File(worldName)) .worldFolder(new File(Bukkit.getWorldContainer(), worldName))
.minHeight(dim.getMinHeight()) .minHeight(dim.getMinHeight())
.maxHeight(dim.getMaxHeight()) .maxHeight(dim.getMaxHeight())
.build(); .build();

View File

@ -84,7 +84,7 @@ public class ServerConfigurator {
private static List<File> getDatapacksFolder() { private static List<File> getDatapacksFolder() {
if (!IrisSettings.get().getGeneral().forceMainWorld.isEmpty()) { if (!IrisSettings.get().getGeneral().forceMainWorld.isEmpty()) {
return new KList<File>().qadd(new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks")); return new KList<File>().qadd(new File(Bukkit.getWorldContainer(), IrisSettings.get().getGeneral().forceMainWorld + "/datapacks"));
} }
KList<File> worlds = new KList<>(); KList<File> worlds = new KList<>();
Bukkit.getServer().getWorlds().forEach(w -> worlds.add(new File(w.getWorldFolder(), "datapacks"))); Bukkit.getServer().getWorlds().forEach(w -> worlds.add(new File(w.getWorldFolder(), "datapacks")));

View File

@ -73,7 +73,7 @@ public class CommandIris implements DecreeExecutor {
return; return;
} }
if (new File(name).exists()) { if (new File(Bukkit.getWorldContainer(), name).exists()) {
sender().sendMessage(C.RED + "That folder already exists!"); sender().sendMessage(C.RED + "That folder already exists!");
return; return;
} }

View File

@ -51,7 +51,7 @@ import java.util.function.Supplier;
@Data @Data
@Accessors(fluent = true, chain = true) @Accessors(fluent = true, chain = true)
public class IrisCreator { public class IrisCreator {
private static final File BUKKIT_YML = new File(Bukkit.getServer().getWorldContainer(), "bukkit.yml"); private static final File BUKKIT_YML = new File("bukkit.yml");
/** /**
* Specify an area to pregenerate during creation * Specify an area to pregenerate during creation
*/ */
@ -115,7 +115,7 @@ public class IrisCreator {
sender = Iris.getSender(); sender = Iris.getSender();
if (!studio()) { if (!studio()) {
Iris.service(StudioSVC.class).installIntoWorld(sender, d.getLoadKey(), new File(name())); Iris.service(StudioSVC.class).installIntoWorld(sender, d.getLoadKey(), new File(Bukkit.getWorldContainer(), name()));
} }
PlatformChunkGenerator access = null; PlatformChunkGenerator access = null;

View File

@ -22,6 +22,7 @@ import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.object.IrisDimension; import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisWorld; import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.platform.BukkitChunkGenerator; import com.volmit.iris.engine.platform.BukkitChunkGenerator;
import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
@ -71,7 +72,7 @@ public class IrisWorldCreator {
.minHeight(dim.getMinHeight()) .minHeight(dim.getMinHeight())
.maxHeight(dim.getMaxHeight()) .maxHeight(dim.getMaxHeight())
.seed(seed) .seed(seed)
.worldFolder(new File(name)) .worldFolder(new File(Bukkit.getWorldContainer(), name))
.environment(findEnvironment()) .environment(findEnvironment())
.build(); .build();
ChunkGenerator g = new BukkitChunkGenerator(w, studio, studio ChunkGenerator g = new BukkitChunkGenerator(w, studio, studio

View File

@ -108,7 +108,7 @@ public class IrisWorld {
public void bind(WorldInfo worldInfo) { public void bind(WorldInfo worldInfo) {
name(worldInfo.getName()) name(worldInfo.getName())
.worldFolder(new File(worldInfo.getName())) .worldFolder(new File(Bukkit.getWorldContainer(), worldInfo.getName()))
.minHeight(worldInfo.getMinHeight()) .minHeight(worldInfo.getMinHeight())
.maxHeight(worldInfo.getMaxHeight()) .maxHeight(worldInfo.getMaxHeight())
.environment(worldInfo.getEnvironment()); .environment(worldInfo.getEnvironment());