package com.untamedears.rourke750.ExpensiveBeacons;

import java.util.logging.Logger;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Beacon;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.BeaconInventory;

import com.untamedears.citadel.Citadel;
import com.untamedears.citadel.entity.IReinforcement;
import com.untamedears.citadel.entity.PlayerReinforcement;

public class BeaconListener implements Listener {
	private MultiBlockStructure multi;
	private StoredValues sv;

	public BeaconListener(MultiBlockStructure plugin, StoredValues store) {
		multi = plugin;
		sv = store;
	}

	@EventHandler(priority = EventPriority.HIGH)
	public void onBlockPlace(BlockPlaceEvent event) {
		Logger logger = Logger.getLogger(ExpensiveBeaconsPlugin.class.getName());
		logger.info("Listener is enabled.");
		if (event.getBlock().getType().equals(Material.BEACON)) {
			Location loc = event.getBlock().getLocation();
			logger.info("Cords of block placed" + loc);
			String groupName = null;
			IReinforcement rein = Citadel.getReinforcementManager().getReinforcement(loc);
			if (rein instanceof PlayerReinforcement) {
				groupName = ((PlayerReinforcement) rein).getOwner().getName();
			}
			logger.info("Setspeedeffects has run");
			if (groupName == null) {

				event.getPlayer().sendMessage("Reinforce the Beacon."); //tells players to reinforce the beacon.
			}
			multi.checkBuild(loc);
		}
	}

	@EventHandler(priority = EventPriority.HIGH)
	public void onBlockBreak(BlockBreakEvent event) {
		if (event.getBlock().getType().equals(Material.BEACON)) {
			Location loc = event.getBlock().getLocation();
			if (sv.getType(loc) != null) {
				sv.removeTier(loc);
				sv.removeType(loc);
			}
		}
	}

	@EventHandler(priority = EventPriority.HIGH)
	public void onPlayerOpenInventory(InventoryOpenEvent event) {
		if (event.getInventory() instanceof BeaconInventory)
			event.setCancelled(true);
	}
}

@@ -1779,32 +1779,33 @@
 tPriority.HIGH)%0A
+%09
 %09public void onB
@@ -1832,32 +1832,30 @@
 Event event)
- 
 %7B%0A%09%09if
- 
 (event.getBl
@@ -1904,33 +1904,32 @@
 %0A%09%09%09Location loc
- 
 = event.getBlock
@@ -1951,17 +1951,16 @@
 );%0A%09%09%09if
- 
 (sv.getT
@@ -1971,18 +1971,15 @@
 loc)
- 
 !=
- 
 null)
- 
 %7B%0A%09%09
@@ -2029,24 +2029,230 @@
 );%0A%09%09%09%7D%0A%09%09%7D%0A
+%09%09if (event.getBlock().getType()==Material.DIAMOND_BLOCK)%7B%0A%09%09%09for (Location loc: sv.getTypeMap().keySet())%7B%0A%09%09if (event.getBlock().getLocation().distance(loc)%3C=50)%7B%0A%09%09%09multi.checkBuild(loc);%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A
 %09%7D%0A%0A%09@EventH

Update BeaconListener.java