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

The following examples show how to use org.bukkit.World#equals() . 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: DeleteIslandChunk.java    From askyblock with GNU General Public License v2.0 6 votes vote down vote up
private void regenerate(World world, Pair<Integer, Integer> minWholeChunk, Pair<Integer, Integer> maxWholeChunk,
        Pair<Integer, Integer> minChunk, Pair<Integer, Integer> maxChunk) {
    for (int i = minChunk.x; i <= maxChunk.x; i++) {
        for (int j = minChunk.z; j <= maxChunk.z; j++) {
            if (i >= minWholeChunk.x && i <= maxWholeChunk.x && j >= minWholeChunk.z && j <= maxWholeChunk.z) {
                world.regenerateChunk(i, j);
                if (Settings.newNether && Settings.createNether) {
                    if (world.equals(ASkyBlock.getIslandWorld())) {
                        ASkyBlock.getNetherWorld().regenerateChunk(i, j);
                    }
                    if (world.equals(ASkyBlock.getNetherWorld())) {
                        ASkyBlock.getIslandWorld().regenerateChunk(i, j);
                    }
                }
            } else {
                chunksToClear.add(new Pair<>(i, j));
            }
        }
    }

}
 
Example 2
Source File: GriefPreventionHook.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public Region getRegion_i(final World world, final String name) {
	try {
		final Claim c = getClaim(Long.parseLong(name));
		if (c != null && world.equals(c.getLesserBoundaryCorner().getWorld()))
			return new GriefPreventionRegion(c);
		return null;
	} catch (final NumberFormatException e) {
		return null;
	}
}
 
Example 3
Source File: DungeonsXL.java    From DungeonsXL with GNU General Public License v3.0 5 votes vote down vote up
public InstanceWorld getInstanceWorld(World world) {
    for (InstanceWorld instance : instanceCache) {
        if (world.equals(instance.getWorld())) {
            return instance;
        }
    }
    return null;
}
 
Example 4
Source File: Util.java    From SkyWarsReloaded with GNU General Public License v3.0 5 votes vote down vote up
public boolean isSpawnWorld(World world) {
	if (SkyWarsReloaded.getCfg().getSpawn() != null) {
		if (world.equals(SkyWarsReloaded.getCfg().getSpawn().getWorld())) {
			return true;
		}
	}
	return false;
}
 
Example 5
Source File: ChunkCoord.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
public void setFromLocation(Location location) {
	//	this.worldname = "world";
//		for (int i = 0; i < worlds.length; i++) {
//			if (location.getWorld() == worlds[i]) {
//				this.worldname = worldnames[i];
//			}
//		}
		for (String name : worlds.keySet()) {
			World world = worlds.get(name);
			if (world == null) {
				continue;
			}
			
			if (world.equals(location.getWorld())) {
				this.worldname = name;
				break;
			}
		}
		
		
		this.x = castToChunkX(location.getBlockX());
		this.z = castToChunkZ(location.getBlockZ());
		
		//	this.setWorldname(location.getWorld().getName());
		
		// Note: We calculate the x and z rather than get the chunk
		// since getting the chunk would require a synchronous operation
		// on the main thread.
		/*CivLog.debug("x("+location.getX()+"): "+ (int)Math.round(location.getX() / CHUNKSIZE)+
				" z("+location.getZ()+"): "+(int)Math.round(location.getZ() / CHUNKSIZE));
		this.setX((int)Math.floor(location.getX()) / CHUNKSIZE);
		this.setZ((int)Math.floor(location.getZ()) / CHUNKSIZE);	*/
		//TODO try to do this without calling getchunk..
		//Chunk chunk = location.getChunk();
		//this.worldname = chunk.getWorld().getName();
		//this.x = chunk.getX();
		//this.z = chunk.getZ();
			
	}
 
Example 6
Source File: IslandGuard.java    From askyblock with GNU General Public License v2.0 5 votes vote down vote up
protected static boolean inWorld(World world) {
    if (world.equals(ASkyBlock.getIslandWorld())) {
        return true;
    }
    return Settings.createNether && Settings.newNether && ASkyBlock.getNetherWorld() != null
            && world.equals(ASkyBlock.getNetherWorld());
}
 
Example 7
Source File: Util.java    From SkyWarsReloaded with GNU General Public License v3.0 4 votes vote down vote up
public boolean isSpawnWorld(World world) {
    return SkyWarsReloaded.getCfg().getSpawn() != null && world.equals(SkyWarsReloaded.getCfg().getSpawn().getWorld());
}