org.bukkit.WorldType Java Examples
The following examples show how to use
org.bukkit.WorldType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorldManager.java From uSkyBlock with GNU General Public License v3.0 | 6 votes |
/** * Gets the skyblock island {@link World}. Creates and/or imports the world if necessary. * @return Skyblock island world. */ @NotNull public synchronized World getWorld() { if (skyBlockWorld == null) { skyBlockWorld = Bukkit.getWorld(Settings.general_worldName); ChunkGenerator skyGenerator = getOverworldGenerator(); ChunkGenerator worldGenerator = skyBlockWorld != null ? skyBlockWorld.getGenerator() : null; if (skyBlockWorld == null || skyBlockWorld.canGenerateStructures() || worldGenerator == null || !worldGenerator.getClass().getName().equals(skyGenerator.getClass().getName())) { skyBlockWorld = WorldCreator .name(Settings.general_worldName) .type(WorldType.NORMAL) .generateStructures(false) .environment(World.Environment.NORMAL) .generator(skyGenerator) .createWorld(); skyBlockWorld.save(); } MultiverseCoreHandler.importWorld(skyBlockWorld); setupWorld(skyBlockWorld, island_height); } return skyBlockWorld; }
Example #2
Source File: WorldManager.java From uSkyBlock with GNU General Public License v3.0 | 6 votes |
/** * Gets the skyblock nether island {@link World}. Creates and/or imports the world if necessary. Returns null if * the nether is not enabled in the plugin configuration. * @return Skyblock nether island world, or null if nether is disabled. */ @Nullable public synchronized World getNetherWorld() { if (skyBlockNetherWorld == null && Settings.nether_enabled) { skyBlockNetherWorld = Bukkit.getWorld(Settings.general_worldName + "_nether"); ChunkGenerator skyGenerator = getNetherGenerator(); ChunkGenerator worldGenerator = skyBlockNetherWorld != null ? skyBlockNetherWorld.getGenerator() : null; if (skyBlockNetherWorld == null || skyBlockNetherWorld.canGenerateStructures() || worldGenerator == null || !worldGenerator.getClass().getName().equals(skyGenerator.getClass().getName())) { skyBlockNetherWorld = WorldCreator .name(Settings.general_worldName + "_nether") .type(WorldType.NORMAL) .generateStructures(false) .environment(World.Environment.NETHER) .generator(skyGenerator) .createWorld(); skyBlockNetherWorld.save(); } MultiverseCoreHandler.importNetherWorld(skyBlockNetherWorld); setupWorld(skyBlockNetherWorld, island_height / 2); MultiverseInventoriesHandler.linkWorlds(getWorld(), skyBlockNetherWorld); } return skyBlockNetherWorld; }
Example #3
Source File: ArenaManager.java From civcraft with GNU General Public License v2.0 | 6 votes |
private static World createArenaWorld(ConfigArena arena, String name) { World world; world = Bukkit.getServer().getWorld(name); if (world == null) { WorldCreator wc = new WorldCreator(name); wc.environment(Environment.NORMAL); wc.type(WorldType.FLAT); wc.generateStructures(false); world = Bukkit.getServer().createWorld(wc); world.setAutoSave(false); world.setSpawnFlags(false, false); world.setKeepSpawnInMemory(false); ChunkCoord.addWorld(world); } return world; }
Example #4
Source File: ASkyBlock.java From askyblock with GNU General Public License v2.0 | 6 votes |
/** * @return the netherWorld */ public static World getNetherWorld() { if (netherWorld == null && Settings.createNether) { if (Settings.useOwnGenerator) { return Bukkit.getServer().getWorld(Settings.worldName +"_nether"); } if (plugin.getServer().getWorld(Settings.worldName + "_nether") == null) { Bukkit.getLogger().info("Creating " + plugin.getName() + "'s Nether..."); } if (!Settings.newNether) { netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.NORMAL).environment(World.Environment.NETHER).createWorld(); } else { netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.FLAT).generator(new ChunkGeneratorWorld()) .environment(World.Environment.NETHER).createWorld(); } netherWorld.setMonsterSpawnLimit(Settings.monsterSpawnLimit); netherWorld.setAnimalSpawnLimit(Settings.animalSpawnLimit); } return netherWorld; }
Example #5
Source File: WorldHandler.java From VoxelGamesLibv2 with MIT License | 5 votes |
/** * Loads a local world * * @param name the world to load * @return the loaded world * @throws WorldException if the world is not found or something else goes wrong */ @Nonnull public World loadLocalWorld(@Nonnull String name) { log.finer("Loading world " + name); org.bukkit.WorldCreator wc = new WorldCreator(name); wc.environment(World.Environment.NORMAL); //TODO do we need support for environment in maps? wc.generateStructures(false); wc.type(WorldType.NORMAL); wc.generator(new CleanRoomChunkGenerator()); wc.generatorSettings(""); World world = wc.createWorld(); world.setAutoSave(false); return world; }
Example #6
Source File: DResourceWorld.java From DungeonsXL with GNU General Public License v3.0 | 5 votes |
/** * Generate a new DResourceWorld. * * @return the automatically created DEditWorld instance */ public DEditWorld generate() { int id = DInstanceWorld.counter; String name = DInstanceWorld.generateName(false, id); File folder = new File(Bukkit.getWorldContainer(), name); WorldCreator creator = new WorldCreator(name); creator.type(WorldType.FLAT); creator.generateStructures(false); DEditWorld editWorld = new DEditWorld(plugin, this, folder); this.editWorld = editWorld; EditWorldGenerateEvent event = new EditWorldGenerateEvent(editWorld); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { return null; } if (!RAW.exists()) { createRaw(); } FileUtil.copyDir(RAW, folder, DungeonsXL.EXCLUDED_FILES); editWorld.generateIdFile(); editWorld.world = creator.createWorld().getName(); editWorld.generateIdFile(); return editWorld; }
Example #7
Source File: DResourceWorld.java From DungeonsXL with GNU General Public License v3.0 | 5 votes |
/** * Creates the "raw" world that is copied for new instances. */ public static void createRaw() { WorldCreator rawCreator = WorldCreator.name(".raw"); rawCreator.type(WorldType.FLAT); rawCreator.generateStructures(false); World world = rawCreator.createWorld(); File worldFolder = new File(Bukkit.getWorldContainer(), ".raw"); FileUtil.copyDir(worldFolder, RAW, DungeonsXL.EXCLUDED_FILES); Bukkit.unloadWorld(world, /* SPIGOT-5225 */ !Version.isAtLeast(Version.MC1_14_4)); FileUtil.removeDir(worldFolder); }
Example #8
Source File: DebugWorldCommand.java From civcraft with GNU General Public License v2.0 | 5 votes |
public void create_cmd() throws CivException { String name = getNamedString(1, "enter a world name"); WorldCreator wc = new WorldCreator(name); wc.environment(Environment.NORMAL); wc.type(WorldType.FLAT); wc.generateStructures(false); World world = Bukkit.getServer().createWorld(wc); world.setSpawnFlags(false, false); ChunkCoord.addWorld(world); CivMessage.sendSuccess(sender, "World "+name+" created."); }
Example #9
Source File: ASkyBlock.java From askyblock with GNU General Public License v2.0 | 5 votes |
/** * Returns the World object for the island world named in config.yml. * If the world does not exist then it is created. * * @return islandWorld - Bukkit World object for the ASkyBlock world */ public static World getIslandWorld() { if (islandWorld == null) { //Bukkit.getLogger().info("DEBUG worldName = " + Settings.worldName); // if (Settings.useOwnGenerator) { islandWorld = Bukkit.getServer().getWorld(Settings.worldName); //Bukkit.getLogger().info("DEBUG world is " + islandWorld); } else { islandWorld = WorldCreator.name(Settings.worldName).type(WorldType.FLAT).environment(World.Environment.NORMAL).generator(new ChunkGeneratorWorld()) .createWorld(); } // Make the nether if it does not exist if (Settings.createNether) { getNetherWorld(); } // Multiverse configuration if (!Settings.useOwnGenerator && Bukkit.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) { // Run sync if (!Bukkit.isPrimaryThread()) { Bukkit.getScheduler().runTask(plugin, ASkyBlock::registerMultiverse); } else { registerMultiverse(); } } } // Set world settings if (islandWorld != null) { islandWorld.setWaterAnimalSpawnLimit(Settings.waterAnimalSpawnLimit); islandWorld.setMonsterSpawnLimit(Settings.monsterSpawnLimit); islandWorld.setAnimalSpawnLimit(Settings.animalSpawnLimit); } return islandWorld; }
Example #10
Source File: AsyncWorld.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public WorldType getWorldType() { return parent.getWorldType(); }
Example #11
Source File: WrapperPlayServerRespawn.java From PacketWrapper with GNU Lesser General Public License v3.0 | 2 votes |
/** * Retrieve the current level type. * @return The current level type */ public WorldType getLevelType() { return handle.getWorldTypeModifier().read(0); }
Example #12
Source File: WrapperPlayServerRespawn.java From PacketWrapper with GNU Lesser General Public License v3.0 | 2 votes |
/** * Set see 0x01 login. * @param value - new world type. */ public void setLevelType(WorldType value) { handle.getWorldTypeModifier().write(0, value); }
Example #13
Source File: WrapperPlayServerLogin.java From PacketWrapper with GNU Lesser General Public License v3.0 | 2 votes |
/** * Retrieve the world type. * <p> * This is the level-type settign (default, flat, or largeBiomes) in server.properties. * @return The current world type. */ public WorldType getLevelType() { return handle.getWorldTypeModifier().read(0); }
Example #14
Source File: WrapperPlayServerLogin.java From PacketWrapper with GNU Lesser General Public License v3.0 | 2 votes |
/** * Set the world type. * <p> * This is the level-type settign (default, flat, or largeBiomes) in server.properties. * @param value - new value. */ public void setLevelType(WorldType type) { handle.getWorldTypeModifier().write(0, type); }