Java Code Examples for org.bukkit.Chunk#unload()

The following examples show how to use org.bukkit.Chunk#unload() . 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: SchematicHandler.java    From UhcCore with GNU General Public License v3.0 6 votes vote down vote up
public static ArrayList<Integer> pasteSchematic(Location loc, File schematicFile, int loadingArea) throws Exception{
    if (loadingArea > 0){
        for (int x = (loc.getBlockX()/16)-loadingArea; x < (loc.getBlockX()/16)+loadingArea; x++) {
            for (int z = (loc.getBlockZ()/16)-loadingArea; z < (loc.getBlockZ()/16)+loadingArea; z++) {
                Chunk chunk = loc.getWorld().getChunkAt(x,z);
                chunk.load(true);
                chunk.unload(true);
            }
        }
    }

    if (UhcCore.getVersion() < 13){
        return SchematicHandler8.pasteSchematic(loc, schematicFile.getPath());
    }else {
        return SchematicHandler13.pasteSchematic(loc, schematicFile.getPath());
    }
}
 
Example 2
Source File: BukkitQueue_1_10.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Deprecated
public boolean unloadChunk(final String world, final Chunk chunk) {
    net.minecraft.server.v1_10_R1.Chunk c = ((CraftChunk) chunk).getHandle();
    c.mustSave = false;
    if (chunk.isLoaded()) {
        chunk.unload(false, false);
    }
    return true;
}
 
Example 3
Source File: BukkitQueue_1_12.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Deprecated
public boolean unloadChunk(final String world, final Chunk chunk) {
    net.minecraft.server.v1_12_R1.Chunk c = ((CraftChunk) chunk).getHandle();
    c.mustSave = false;
    if (chunk.isLoaded()) {
        chunk.unload(false, false);
    }
    return true;
}
 
Example 4
Source File: BukkitQueue_1_9_R1.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Deprecated
public boolean unloadChunk(final String world, final Chunk chunk) {
    net.minecraft.server.v1_9_R2.Chunk c = ((CraftChunk) chunk).getHandle();
    c.mustSave = false;
    if (chunk.isLoaded()) {
        chunk.unload(false, false);
    }
    return true;
}
 
Example 5
Source File: BukkitQueue_1_11.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Deprecated
public boolean unloadChunk(final String world, final Chunk chunk) {
    net.minecraft.server.v1_11_R1.Chunk c = ((CraftChunk) chunk).getHandle();
    c.mustSave = false;
    if (chunk.isLoaded()) {
        chunk.unload(false, false);
    }
    return true;
}
 
Example 6
Source File: ChunkGenerateTask.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void run() {

	int maxgen = 10;
	int i = 0;

	for (int x = startX; x <= stopX; x++) {
		for (int z = startZ; z <= stopZ; z++) {
			i++;
			
			Chunk chunk = Bukkit.getWorld("world").getChunkAt(x, z);
			if (!chunk.load(true)) {
			}
			
			if (!chunk.unload(true, false)) {
			}
			
			if (i > maxgen) {
				TaskMaster.syncTask(new ChunkGenerateTask(x, z, stopX, stopZ));
				return;
			}
			
		}
	}
	
	
}