Skip to content

Commit

Permalink
Travaille pour la compatiblité de folia 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Euphillya committed Feb 8, 2024
1 parent c36fb45 commit 89e4161
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,12 @@ private static void setRandom(ServerLevel serverLevel) {

@Override
public WorldFeedback.FeedbackWorld createWorld(WorldCreator creator) {
if (true) {
throw new UnsupportedOperationException("Pas encore supporté !");
}
//io.papermc.paper.threadedregions.RegionizedServer.ensureGlobalTickThread("World create can be done only on global tick thread");
fr.euphyllia.skyllia.utils.nms.v1_20_R2.WorldNMS.ensureGlobalTickThread();
CraftServer craftServer = (CraftServer) Bukkit.getServer();
DedicatedServer console = craftServer.getServer();
Preconditions.checkState(console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP");
//Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes.
Preconditions.checkState(!console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes.
Preconditions.checkArgument(creator != null, "WorldCreator cannot be null");

String name = creator.name();
Expand All @@ -100,12 +97,10 @@ public WorldFeedback.FeedbackWorld createWorld(WorldCreator creator) {
// Paper start
World worldByKey = craftServer.getWorld(creator.key());
if (world != null || worldByKey != null) {
if (world == worldByKey) {
if (world != worldByKey) {
return WorldFeedback.Feedback.WORLD_DUPLICATED.toFeedbackWorld();
}
throw new IllegalArgumentException("Cannot create a world with key " + creator.key() + " and name " + name + " one (or both) already match a world that exists");
}
// Paper end

if ((folder.exists()) && (!folder.isDirectory())) {
return WorldFeedback.Feedback.WORLD_FOLDER_INVALID.toFeedbackWorld();
Expand Down Expand Up @@ -188,7 +183,7 @@ public WorldFeedback.FeedbackWorld createWorld(WorldCreator creator) {

DedicatedServerProperties.WorldDimensionData properties = new DedicatedServerProperties.WorldDimensionData(GsonHelper.parse((creator.generatorSettings().isEmpty()) ? "{}" : creator.generatorSettings()), creator.type().name().toLowerCase(Locale.ROOT));

worldsettings = new LevelSettings(name, GameType.byId(craftServer.getDefaultGameMode().getValue()), hardcore, Difficulty.EASY, false, new GameRules(), worldloader_a.dataConfiguration());
worldsettings = new LevelSettings(name, getGameType(GameMode.SURVIVAL), hardcore, Difficulty.EASY, false, new GameRules(), worldloader_a.dataConfiguration());
worlddimensions = properties.create(worldloader_a.datapackWorldgen());

WorldDimensions.Complete worlddimensions_b = worlddimensions.bake(iregistry);
Expand Down

0 comments on commit 89e4161

Please sign in to comment.