Created
August 29, 2018 22:04
-
-
Save TheFlash787/adbb348949b8b61a3bb19679b766abcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!optWorld.isPresent()){ | |
//world doesnt exist | |
WorldArchetype settings = WorldArchetype.builder().enabled(true).loadsOnStartup(false).usesMapFeatures(false).generatorModifiers(WorldGeneratorModifiers.VOID).build(name, name); | |
WorldProperties properties; | |
try { | |
properties = Sponge.getServer().createWorldProperties(name, settings); | |
Sponge.getServer().saveWorldProperties(properties); | |
pistonSponge.getPistonLogger().debug("PistonWorld:"+name+" created!"); | |
Sponge.getServer().loadWorld(name); | |
pistonSponge.getPistonLogger().debug("PistonWorld:"+name+" loaded!"); | |
Optional<World> world = Sponge.getServer().getWorld(name); | |
if(world.isPresent() && !this.pistonWorlds.contains(world)){ | |
this.pistonWorlds.add(world.get()); | |
} | |
return world; | |
} catch(IOException ex){ | |
ex.printStackTrace(); | |
} | |
return Optional.empty(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment