package com.encrox.zombie; import java.util.ArrayList; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.plugin.Plugin; import com.encrox.instancedregions.InstancedProtectedCuboidRegion; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion; public class ZombieWorld { private Plugin plugin; private World world; private ArrayList regions; private int lastX; public ZombieWorld(Plugin plugin, World world) { this.world = world; this.plugin = plugin; regions = new ArrayList(); lastX = 0; } public InstancedProtectedCuboidRegion allocate(int width, int length) { BlockVector min, max; InstancedProtectedCuboidRegion region; for(int i = 0; true; i+=16) { if(new ProtectedCuboidRegion("current", (min = new BlockVector(lastX+i, 0, 0)), (max = new BlockVector(lastX+i+width, 255, length))).getIntersectingRegions(regions).isEmpty()) { region = new InstancedProtectedCuboidRegion(plugin, world, ""+min.getBlockX(), min, max); regions.add(region); return region; } } } public InstancedProtectedCuboidRegion allocate(Schematic schematic) { BlockVector min, max; InstancedProtectedCuboidRegion region; for(int i = 0; true; i+=16) { if(new ProtectedCuboidRegion("current", (min = new BlockVector(lastX+i, 0, 0)), (max = new BlockVector(lastX+i+schematic.width, 255, schematic.length))).getIntersectingRegions(regions).isEmpty()) { region = new InstancedProtectedCuboidRegion(plugin, world, ""+min.getBlockX(), min, max); schematic.reset(); for(int y = 0; y