// Path: src/com/maximuspayne/navycraft/plugins/PermissionInterface.java
// public class PermissionInterface {
// 	public static NavyCraft plugin;
// 	//public static PermissionInfo Permissions = null;
// 
// 	public static void setupPermissions(NavyCraft p) {
// 		plugin = p;
// 		PluginManager pm = NavyCraft.instance.getServer().getPluginManager();
// 		if(pm != null) {
// 			pm.addPermission(new Permission("navycraft.periscope.use"));
// 			pm.addPermission(new Permission("navycraft.aa-gun.use"));
// 			pm.addPermission(new Permission("navycraft.periscope.create"));
// 			pm.addPermission(new Permission("navycraft.aa-gun.create"));
// 			
// 			for (CraftType type : CraftType.craftTypes) 
// 			{
// 				pm.addPermission(new Permission("navycraft." + type.name + ".release"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".info"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".takeover"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".start"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".create"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".sink"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".remove"));
// 			}
// 		}
// 	}
// 	
// 	
// 	
// 	public static boolean CheckPerm(Player player, String command) {		
// 		command = command.replace(" ", ".");
// 		NavyCraft.instance.DebugMessage("Checking if " + player.getName() + " can " + command, 3);
// 		
// 		
// 		    if( player.hasPermission(command) || player.isOp() ) 
// 		    {
// 		    	NavyCraft.instance.DebugMessage("Player has permissions: " + command, 3);
// 		    	NavyCraft.instance.DebugMessage("Player isop: " + 
// 		    			player.isOp(), 3);
// 		    	return true;
// 		    } else 
// 		    {
// 				player.sendMessage("You do not have permission to perform " + command);
// 				return false;
// 		    }
// 	}
// 	
// 	public static boolean CheckQuietPerm(Player player, String command) {		
// 		command = command.replace(" ", ".");
// 		NavyCraft.instance.DebugMessage("Checking if " + player.getName() + " can " + command, 3);
// 		
// 		
// 		    if( player.hasPermission(command) || player.isOp() ) 
// 		    {
// 		    	NavyCraft.instance.DebugMessage("Player has permissions: " + command, 3);
// 		    	NavyCraft.instance.DebugMessage("Player isop: " + 
// 		    			player.isOp(), 3);
// 		    	return true;
// 		    } else 
// 		    {
// 				//player.sendMessage("You do not have permission to perform " + command);
// 				return false;
// 		    }
// 	}
// 	
// 	public static boolean CheckEnabledWorld(Location loc) {
// 		if(!plugin.ConfigSetting("EnabledWorlds").equalsIgnoreCase("null")) {
// 			String[] worlds = NavyCraft.instance.ConfigSetting("EnabledWorlds").split(",");
// 			for(int i = 0; i < worlds.length; i++) {
// 				if( loc.getWorld().getName().equalsIgnoreCase(worlds[i]) )
// 				{
// 					return true;
// 				}
// 					
// 			}
// 			return false;
// 		}
// 		return true;
// 	}
// }


import org.bukkit.Location;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.plugin.Plugin;
import com.maximuspayne.navycraft.plugins.PermissionInterface;
    							}
    						}
    					}
    				}
    				NavyCraft.shotTNTList.remove(ent.getUniqueId());
    			}
    			else
    				structureUpdate(event.getLocation(), null);
    		}
    	}
 
    }
    
    
    public Craft structureUpdate(Location loc, Player causer)
    {
    	Craft testcraft = Craft.getCraft(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
		if( testcraft != null )
		{
			CraftMover cm = new CraftMover(testcraft, plugin);
			cm.structureUpdate(causer,false);
			return testcraft;
		}
		return null;
    }
    
    @EventHandler(priority = EventPriority.HIGH)
    public void onCreatureSpawn(CreatureSpawnEvent event)
    {

// Path: src/com/maximuspayne/navycraft/plugins/PermissionInterface.java
// public class PermissionInterface {
// 	public static NavyCraft plugin;
// 	//public static PermissionInfo Permissions = null;
// 
// 	public static void setupPermissions(NavyCraft p) {
// 		plugin = p;
// 		PluginManager pm = NavyCraft.instance.getServer().getPluginManager();
// 		if(pm != null) {
// 			pm.addPermission(new Permission("navycraft.periscope.use"));
// 			pm.addPermission(new Permission("navycraft.aa-gun.use"));
// 			pm.addPermission(new Permission("navycraft.periscope.create"));
// 			pm.addPermission(new Permission("navycraft.aa-gun.create"));
// 			
// 			for (CraftType type : CraftType.craftTypes) 
// 			{
// 				pm.addPermission(new Permission("navycraft." + type.name + ".release"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".info"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".takeover"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".start"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".create"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".sink"));
// 				pm.addPermission(new Permission("navycraft." + type.name + ".remove"));
// 			}
// 		}
// 	}
// 	
// 	
// 	
// 	public static boolean CheckPerm(Player player, String command) {		
// 		command = command.replace(" ", ".");
// 		NavyCraft.instance.DebugMessage("Checking if " + player.getName() + " can " + command, 3);
// 		
// 		
// 		    if( player.hasPermission(command) || player.isOp() ) 
// 		    {
// 		    	NavyCraft.instance.DebugMessage("Player has permissions: " + command, 3);
// 		    	NavyCraft.instance.DebugMessage("Player isop: " + 
// 		    			player.isOp(), 3);
// 		    	return true;
// 		    } else 
// 		    {
// 				player.sendMessage("You do not have permission to perform " + command);
// 				return false;
// 		    }
// 	}
// 	
// 	public static boolean CheckQuietPerm(Player player, String command) {		
// 		command = command.replace(" ", ".");
// 		NavyCraft.instance.DebugMessage("Checking if " + player.getName() + " can " + command, 3);
// 		
// 		
// 		    if( player.hasPermission(command) || player.isOp() ) 
// 		    {
// 		    	NavyCraft.instance.DebugMessage("Player has permissions: " + command, 3);
// 		    	NavyCraft.instance.DebugMessage("Player isop: " + 
// 		    			player.isOp(), 3);
// 		    	return true;
// 		    } else 
// 		    {
// 				//player.sendMessage("You do not have permission to perform " + command);
// 				return false;
// 		    }
// 	}
// 	
// 	public static boolean CheckEnabledWorld(Location loc) {
// 		if(!plugin.ConfigSetting("EnabledWorlds").equalsIgnoreCase("null")) {
// 			String[] worlds = NavyCraft.instance.ConfigSetting("EnabledWorlds").split(",");
// 			for(int i = 0; i < worlds.length; i++) {
// 				if( loc.getWorld().getName().equalsIgnoreCase(worlds[i]) )
// 				{
// 					return true;
// 				}
// 					
// 			}
// 			return false;
// 		}
// 		return true;
// 	}
// }


// Path: src/com/maximuspayne/navycraft/MoveCraft_EntityListener.java
import org.bukkit.Location;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.plugin.Plugin;
import com.maximuspayne.navycraft.plugins.PermissionInterface;

    							}
    						}
    					}
    				}
    				NavyCraft.shotTNTList.remove(ent.getUniqueId());
    			}
    			else
    				structureUpdate(event.getLocation(), null);
    		}
    	}
 
    }
    
    
    public Craft structureUpdate(Location loc, Player causer)
    {
    	Craft testcraft = Craft.getCraft(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
		if( testcraft != null )
		{
			CraftMover cm = new CraftMover(testcraft, plugin);
			cm.structureUpdate(causer,false);
			return testcraft;
		}
		return null;
    }
    
    @EventHandler(priority = EventPriority.HIGH)
    public void onCreatureSpawn(CreatureSpawnEvent event)
    {

    	if( PermissionInterface.CheckEnabledWorld(event.getEntity().getLocation()) )