package com.censoredsoftware.Demigods.Engine.Utility;

import java.util.HashSet;
import java.util.Set;

import org.bukkit.Location;

import com.censoredsoftware.Demigods.Engine.Demigods;
import com.censoredsoftware.Demigods.Engine.Object.Structure.StructureInfo;
import com.censoredsoftware.Demigods.Engine.Object.Structure.StructureSave;
import com.censoredsoftware.Demigods.Engine.Object.Structure.StructureSchematic;

public class StructureUtility
{
	public static boolean partOfStructure(Location location)
	{
		for(StructureSave structureSave : getAllStructureSaves())
		{
			if(structureSave.getLocations().contains(location)) return true;
		}
		return false;
	}

	public static boolean partOfStructureWithFlag(Location location, StructureInfo.Flag flag)
	{
		Demigods.message.broadcast("Looking for structures...");
		for(StructureSave structureSave : getAllStructureSaves())
		{
			if(structureSave.getLocations().contains(location) && structureSave.getStructureInfo().getFlags().contains(flag)) return true;
		}
		Demigods.message.broadcast("Not found.");
		return false;
	}

	public static Set<StructureSave> getAllStructureSaves()
	{
		return DataUtility.jOhm.getAll(StructureSave.class);
	}

	public static Set<Location> getLocations(final Location reference, final Set<StructureSchematic> schematics)
	{
		return new HashSet<Location>()
		{
			{
				for(StructureSchematic schematic : schematics)
				{
					addAll(schematic.getBlockLocations(reference));
				}
			}
		};
	}
}

@@ -130,62 +130,8 @@
 n;%0A%0A
-import com.censoredsoftware.Demigods.Engine.Demigods;%0A
 impo
@@ -707,67 +707,8 @@
 %0A%09%7B%0A
-%09%09Demigods.message.broadcast(%22Looking for structures...%22);%0A
 %09%09fo
@@ -905,52 +905,8 @@
 %09%09%7D%0A
-%09%09Demigods.message.broadcast(%22Not found.%22);%0A
 %09%09re

Remove debugging messages.