Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed null world on biome set #774

Merged
merged 3 commits into from
Jan 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,16 @@ public void createWorld(World.Environment environment, String name) {
}

public void setIslandBiome(@NotNull Island island, @NotNull XBiome biome) {
World.Environment environment = biome.getEnvironment();

World.Environment dimension = biome.getEnvironment();
World world;
switch (environment) {
case NETHER:
world = getWorld(World.Environment.NETHER);
break;
case THE_END:
world = getWorld(World.Environment.THE_END);
break;
default:
world = getWorld(World.Environment.NORMAL);
break;

if(!IridiumSkyblock.getInstance().getConfiguration().enabledWorlds.containsKey(dimension)) {
return;
}

world = getWorld(dimension);

getIslandChunks(island).thenAccept(chunks -> {
Location pos1 = island.getPosition1(world);
Location pos2 = island.getPosition2(world);
Expand Down Expand Up @@ -231,9 +227,23 @@ public CompletableFuture<Void> generateIsland(Island island, Schematics.Schemati
setHome(island, schematicConfig);
deleteIslandBlocks(island).join();
IridiumSkyblock.getInstance().getSchematicManager().pasteSchematic(island, schematicConfig).join();
setIslandBiome(island, XBiome.matchXBiome(schematicConfig.overworld.biome));
setIslandBiome(island, XBiome.matchXBiome(schematicConfig.nether.biome));
setIslandBiome(island, XBiome.matchXBiome(schematicConfig.end.biome));

for(Map.Entry<World.Environment, Boolean> enabledWorld : IridiumSkyblock.getInstance().getConfiguration().enabledWorlds.entrySet()) {
if(!enabledWorld.getValue()) {
continue;
}

switch (enabledWorld.getKey()) {
case NETHER:
setIslandBiome(island, XBiome.matchXBiome(schematicConfig.nether.biome));
break;
case THE_END:
setIslandBiome(island, XBiome.matchXBiome(schematicConfig.end.biome));
break;
default:
setIslandBiome(island, XBiome.matchXBiome(schematicConfig.overworld.biome));
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this section not stay how it is? since we already handle if the world is enabled in setIslandBiome no?

I think the previous code is alot cleaner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ill do some testing, i also found it a bit redundant but i wanted to make sure we got rid of the problem

this still doesn't help anything if the worlds are enabled/disabled during server runtime - this is a separate issue tho

});
}

Expand Down
Loading