Java Code Examples for org.bukkit.World#setKeepSpawnInMemory()

The following examples show how to use org.bukkit.World#setKeepSpawnInMemory() . 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: ArenaManager.java    From civcraft with GNU General Public License v2.0 6 votes vote down vote up
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 2
Source File: WorldManagerImpl.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public World createWorld(String worldName) throws ModuleLoadException, IOException {
    if(server.getWorlds().isEmpty()) {
        throw new IllegalStateException("Can't create a world because there is no default world to derive it from");
    }

    try {
        importDestructive(terrainOptions.worldFolder().toFile(), worldName);
    } catch(FileNotFoundException e) {
        // If files are missing, just inform the mapmaker.
        // Other IOExceptions are considered internal errors.
        throw new ModuleLoadException(e.getMessage()); // Don't set the cause, it's redundant
    }

    final WorldCreator creator = worldCreator(worldName);
    worldConfigurators.forEach(wc -> wc.configureWorld(creator));

    final World world = server.createWorld(creator);
    if(world == null) {
        throw new IllegalStateException("Failed to create world (Server.createWorld returned null)");
    }

    world.setAutoSave(false);
    world.setKeepSpawnInMemory(false);
    world.setDifficulty(Optional.ofNullable(mapInfo.difficulty)
                                .orElseGet(() -> server.getWorlds().get(0).getDifficulty()));

    return world;
}
 
Example 3
Source File: BukkitQueue_0.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public static void onWorldLoad(WorldInitEvent event) {
    if (disableChunkLoad) {
        World world = event.getWorld();
        world.setKeepSpawnInMemory(false);
    }
}
 
Example 4
Source File: DWorldListener.java    From DungeonsXL with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST)
public void onInit(WorldInitEvent event) {
    World world = event.getWorld();
    if (plugin.isInstance(world)) {
        world.setKeepSpawnInMemory(false);
    }
}