Program: 33861
Project: 33861
Buggy source:
/** 
 * Handles interaction with objects
 * @param e
 */
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled=true) public void onPlayerInteract(final PlayerInteractEvent e){
  if (DEBUG) {
    plugin.getLogger().info(e.getEventName());
  }
  if (!inWorld(e.getPlayer())) {
    return;
  }
  if (e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")) {
    return;
  }
  if ((e.getClickedBlock() != null && plugin.getGrid().locationIsOnIsland(e.getPlayer(),e.getClickedBlock().getLocation()))) {
    return;
  }
  if (e.getClickedBlock() == null && (e.getMaterial() != null && plugin.getGrid().playerIsOnIsland(e.getPlayer()))) {
    return;
  }
  Island island=plugin.getGrid().getProtectedIslandAt(e.getPlayer().getLocation());
  if (e.getClickedBlock() != null) {
    if (DEBUG) {
      plugin.getLogger().info("String_Node_Str" + e.getClickedBlock());
      plugin.getLogger().info("String_Node_Str" + e.getMaterial());
    }
    try {
      BlockIterator iter=new BlockIterator(e.getPlayer(),10);
      Block lastBlock=iter.next();
      while (iter.hasNext()) {
        lastBlock=iter.next();
        if (DEBUG)         plugin.getLogger().info("String_Node_Str" + lastBlock.toString());
        if (lastBlock.equals(e.getClickedBlock())) {
          if (DEBUG)           plugin.getLogger().info("String_Node_Str");
          break;
        }
        if (lastBlock.getType().equals(Material.FIRE)) {
          if (DEBUG)           plugin.getLogger().info("String_Node_Str");
          if (island != null) {
            if (!island.getIgsFlag(SettingsFlag.FIRE_EXTINGUISH)) {
              Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
              e.setCancelled(true);
              return;
            }
          }
 else {
            if (Settings.defaultWorldSettings.get(SettingsFlag.FIRE_EXTINGUISH)) {
              if (DEBUG)               plugin.getLogger().info("String_Node_Str");
              continue;
            }
 else {
              Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
              e.setCancelled(true);
              return;
            }
          }
        }
      }
    }
 catch (    Exception ex) {
      if (DEBUG) {
        plugin.getLogger().info("String_Node_Str");
        ex.printStackTrace();
      }
    }
    if (e.getClickedBlock().getType().toString().contains("String_Node_Str")) {
      if (island == null) {
        if (!Settings.defaultWorldSettings.get(SettingsFlag.CHEST)) {
          Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
          e.setCancelled(true);
        }
      }
 else       if (!island.getIgsFlag(SettingsFlag.CHEST)) {
        Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
        e.setCancelled(true);
      }
      return;
    }
    if (e.getMaterial() != null && e.getMaterial().equals(Material.FIREWORK)) {
      if (island == null) {
        if (!Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
          Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
          e.setCancelled(true);
        }
      }
 else       if (!island.getIgsFlag(SettingsFlag.PLACE_BLOCKS)) {
        Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
        e.setCancelled(true);
      }
      return;
    }
switch (e.getClickedBlock().getType()) {
case WOODEN_DOOR:
case SPRUCE_DOOR:
case ACACIA_DOOR:
case DARK_OAK_DOOR:
case BIRCH_DOOR:
case JUNGLE_DOOR:
case TRAP_DOOR:
      if (island == null) {
        if (Settings.defaultWorldSettings.get(SettingsFlag.DOOR)) {
          return;
        }
 else {
          Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
          e.setCancelled(true);
          return;
        }
      }
    if (!island.getIgsFlag(SettingsFlag.DOOR)) {
      Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
      e.setCancelled(true);
      return;
    }
  break;
case FENCE_GATE:
case SPRUCE_FENCE_GATE:
case ACACIA_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case BIRCH_FENCE_GATE:
case JUNGLE_FENCE_GATE:
if (island == null) {
  if (Settings.defaultWorldSettings.get(SettingsFlag.GATE)) {
    return;
  }
 else {
    Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
    e.setCancelled(true);
    return;
  }
}
if (!island.getIgsFlag(SettingsFlag.GATE)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case ENDER_CHEST:
break;
case CHEST:
case TRAPPED_CHEST:
case DISPENSER:
case DROPPER:
case HOPPER:
case HOPPER_MINECART:
case STORAGE_MINECART:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.CHEST)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.CHEST)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case SOIL:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.CROP_TRAMPLE)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.CROP_TRAMPLE)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case BREWING_STAND:
case CAULDRON:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREWING)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.BREWING)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case DIODE:
case DIODE_BLOCK_OFF:
case DIODE_BLOCK_ON:
case REDSTONE_COMPARATOR_ON:
case REDSTONE_COMPARATOR_OFF:
case DAYLIGHT_DETECTOR:
case DAYLIGHT_DETECTOR_INVERTED:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.REDSTONE)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.REDSTONE)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case ENCHANTMENT_TABLE:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.ENCHANTING)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.ENCHANTING)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case FURNACE:
case BURNING_FURNACE:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.FURNACE)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.FURNACE)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case ICE:
break;
case ITEM_FRAME:
break;
case JUKEBOX:
if (DEBUG) plugin.getLogger().info("String_Node_Str");
case NOTE_BLOCK:
if (island == null) {
if (DEBUG) plugin.getLogger().info("String_Node_Str");
if (Settings.defaultWorldSettings.get(SettingsFlag.MUSIC)) {
return;
}
 else {
if (DEBUG) plugin.getLogger().info("String_Node_Str");
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.MUSIC)) {
if (DEBUG) plugin.getLogger().info("String_Node_Str");
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case PACKED_ICE:
break;
case STONE_BUTTON:
case WOOD_BUTTON:
case LEVER:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.LEVER_BUTTON)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.LEVER_BUTTON)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case TNT:
break;
case WORKBENCH:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.CRAFTING)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.CRAFTING)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case ANVIL:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.ANVIL)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.ANVIL)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case RAILS:
case POWERED_RAIL:
case DETECTOR_RAIL:
case ACTIVATOR_RAIL:
if (island == null) {
if (!Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
return;
}
if (!island.getIgsFlag(SettingsFlag.PLACE_BLOCKS)) {
if (e.getMaterial() == Material.MINECART || e.getMaterial() == Material.STORAGE_MINECART || e.getMaterial() == Material.HOPPER_MINECART || e.getMaterial() == Material.EXPLOSIVE_MINECART || e.getMaterial() == Material.POWERED_MINECART) {
e.setCancelled(true);
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.getPlayer().updateInventory();
return;
}
}
case BEACON:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.BEACON)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.BEACON)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case CAKE_BLOCK:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.getPlayer().setFoodLevel(e.getPlayer().getFoodLevel() - 2);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.BREAK_BLOCKS)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.getPlayer().setFoodLevel(e.getPlayer().getFoodLevel() - 2);
e.setCancelled(true);
return;
}
break;
case DRAGON_EGG:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.BREAK_BLOCKS)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case MOB_SPAWNER:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.BREAK_BLOCKS)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case BED_BLOCK:
if (e.getPlayer().getWorld().getEnvironment().equals(Environment.NETHER)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
default :
break;
}
}
if (DEBUG) {
plugin.getLogger().info("String_Node_Str" + e.getMaterial());
plugin.getLogger().info("String_Node_Str" + e.getPlayer().getItemInHand().toString());
}
if (e.getMaterial() != null) {
if (e.getMaterial() == Material.WOOD_DOOR || e.getMaterial() == Material.CHEST || e.getMaterial() == Material.TRAPPED_CHEST || e.getMaterial() == Material.IRON_DOOR) {
if ((island == null && Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) || (island != null && !island.getIgsFlag(SettingsFlag.PLACE_BLOCKS))) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
e.getPlayer().updateInventory();
return;
}
}
 else if (e.getMaterial().name().contains("String_Node_Str") && (e.getClickedBlock() != null && !e.getClickedBlock().isLiquid())) {
if ((island == null && Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) || (island != null && !island.getIgsFlag(SettingsFlag.PLACE_BLOCKS))) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
 else if (e.getMaterial().equals(Material.ENDER_PEARL)) {
if ((island == null && Settings.defaultWorldSettings.get(SettingsFlag.ENDER_PEARL)) || (island != null && !island.getIgsFlag(SettingsFlag.ENDER_PEARL))) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
return;
}
 else if (e.getMaterial().equals(Material.FLINT_AND_STEEL)) {
plugin.getLogger().info("String_Node_Str");
if (e.getClickedBlock() != null) {
if (e.getMaterial().equals(Material.OBSIDIAN)) {
plugin.getLogger().info("String_Node_Str");
}
if (!actionAllowed(e.getPlayer(),e.getClickedBlock().getLocation(),SettingsFlag.FIRE)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
}
return;
}
 else if (e.getMaterial().equals(Material.MONSTER_EGG)) {
if (DEBUG) plugin.getLogger().info("String_Node_Str" + island.getIgsFlag(SettingsFlag.SPAWN_EGGS));
if (!actionAllowed(e.getPlayer(),e.getClickedBlock().getLocation(),SettingsFlag.SPAWN_EGGS)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
return;
}
 else if (e.getMaterial().equals(Material.POTION) && e.getItem().getDurability() != 0) {
try {
Potion p=Potion.fromItemStack(e.getItem());
if (p.isSplash()) {
boolean inNether=false;
if (e.getPlayer().getWorld().equals(ASkyBlock.getNetherWorld())) {
inNether=true;
}
if (island == null) {
if ((inNether && Settings.defaultWorldSettings.get(SettingsFlag.NETHER_PVP) || (!inNether && Settings.defaultWorldSettings.get(SettingsFlag.PVP)))) {
return;
}
}
 else {
if ((inNether && island.getIgsFlag(SettingsFlag.NETHER_PVP) || (!inNether && island.getIgsFlag(SettingsFlag.PVP)))) {
return;
}
}
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
}
 catch (Exception ex) {
}
}
}
}

Fixed version (ground truth):
/** 
 * Handles interaction with objects
 * @param e
 */
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled=true) public void onPlayerInteract(final PlayerInteractEvent e){
  if (DEBUG) {
    plugin.getLogger().info(e.getEventName());
  }
  if (!inWorld(e.getPlayer())) {
    return;
  }
  if (e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")) {
    return;
  }
  if ((e.getClickedBlock() != null && plugin.getGrid().locationIsOnIsland(e.getPlayer(),e.getClickedBlock().getLocation()))) {
    return;
  }
  if (e.getClickedBlock() == null && (e.getMaterial() != null && plugin.getGrid().playerIsOnIsland(e.getPlayer()))) {
    return;
  }
  Island island=plugin.getGrid().getProtectedIslandAt(e.getPlayer().getLocation());
  if (e.getClickedBlock() != null) {
    if (DEBUG) {
      plugin.getLogger().info("String_Node_Str" + e.getClickedBlock());
      plugin.getLogger().info("String_Node_Str" + e.getMaterial());
    }
    try {
      BlockIterator iter=new BlockIterator(e.getPlayer(),10);
      Block lastBlock=iter.next();
      while (iter.hasNext()) {
        lastBlock=iter.next();
        if (DEBUG)         plugin.getLogger().info("String_Node_Str" + lastBlock.toString());
        if (lastBlock.equals(e.getClickedBlock())) {
          if (DEBUG)           plugin.getLogger().info("String_Node_Str");
          break;
        }
        if (lastBlock.getType().equals(Material.FIRE)) {
          if (DEBUG)           plugin.getLogger().info("String_Node_Str");
          if (island != null) {
            if (!island.getIgsFlag(SettingsFlag.FIRE_EXTINGUISH)) {
              Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
              e.setCancelled(true);
              return;
            }
          }
 else {
            if (Settings.defaultWorldSettings.get(SettingsFlag.FIRE_EXTINGUISH)) {
              if (DEBUG)               plugin.getLogger().info("String_Node_Str");
              continue;
            }
 else {
              Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
              e.setCancelled(true);
              return;
            }
          }
        }
      }
    }
 catch (    Exception ex) {
      if (DEBUG) {
        plugin.getLogger().info("String_Node_Str");
        ex.printStackTrace();
      }
    }
    if (e.getClickedBlock().getType().toString().contains("String_Node_Str")) {
      if (island == null) {
        if (!Settings.defaultWorldSettings.get(SettingsFlag.CHEST)) {
          Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
          e.setCancelled(true);
        }
      }
 else       if (!island.getIgsFlag(SettingsFlag.CHEST)) {
        Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
        e.setCancelled(true);
      }
      return;
    }
    if (e.getMaterial() != null && e.getMaterial().equals(Material.FIREWORK)) {
      if (island == null) {
        if (!Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
          Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
          e.setCancelled(true);
        }
      }
 else       if (!island.getIgsFlag(SettingsFlag.PLACE_BLOCKS)) {
        Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
        e.setCancelled(true);
      }
      return;
    }
switch (e.getClickedBlock().getType()) {
case WOODEN_DOOR:
case SPRUCE_DOOR:
case ACACIA_DOOR:
case DARK_OAK_DOOR:
case BIRCH_DOOR:
case JUNGLE_DOOR:
case TRAP_DOOR:
      if (island == null) {
        if (Settings.defaultWorldSettings.get(SettingsFlag.DOOR)) {
          return;
        }
 else {
          Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
          e.setCancelled(true);
          return;
        }
      }
    if (!island.getIgsFlag(SettingsFlag.DOOR)) {
      Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
      e.setCancelled(true);
      return;
    }
  break;
case FENCE_GATE:
case SPRUCE_FENCE_GATE:
case ACACIA_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case BIRCH_FENCE_GATE:
case JUNGLE_FENCE_GATE:
if (island == null) {
  if (Settings.defaultWorldSettings.get(SettingsFlag.GATE)) {
    return;
  }
 else {
    Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
    e.setCancelled(true);
    return;
  }
}
if (!island.getIgsFlag(SettingsFlag.GATE)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case ENDER_CHEST:
break;
case CHEST:
case TRAPPED_CHEST:
case DISPENSER:
case DROPPER:
case HOPPER:
case HOPPER_MINECART:
case STORAGE_MINECART:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.CHEST)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.CHEST)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case SOIL:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.CROP_TRAMPLE)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.CROP_TRAMPLE)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case BREWING_STAND:
case CAULDRON:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREWING)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.BREWING)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case DIODE:
case DIODE_BLOCK_OFF:
case DIODE_BLOCK_ON:
case REDSTONE_COMPARATOR_ON:
case REDSTONE_COMPARATOR_OFF:
case DAYLIGHT_DETECTOR:
case DAYLIGHT_DETECTOR_INVERTED:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.REDSTONE)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.REDSTONE)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case ENCHANTMENT_TABLE:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.ENCHANTING)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.ENCHANTING)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case FURNACE:
case BURNING_FURNACE:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.FURNACE)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.FURNACE)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case ICE:
break;
case ITEM_FRAME:
break;
case JUKEBOX:
if (DEBUG) plugin.getLogger().info("String_Node_Str");
case NOTE_BLOCK:
if (island == null) {
if (DEBUG) plugin.getLogger().info("String_Node_Str");
if (Settings.defaultWorldSettings.get(SettingsFlag.MUSIC)) {
return;
}
 else {
if (DEBUG) plugin.getLogger().info("String_Node_Str");
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.MUSIC)) {
if (DEBUG) plugin.getLogger().info("String_Node_Str");
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case PACKED_ICE:
break;
case STONE_BUTTON:
case WOOD_BUTTON:
case LEVER:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.LEVER_BUTTON)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.LEVER_BUTTON)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case TNT:
break;
case WORKBENCH:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.CRAFTING)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.CRAFTING)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case ANVIL:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.ANVIL)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.ANVIL)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case RAILS:
case POWERED_RAIL:
case DETECTOR_RAIL:
case ACTIVATOR_RAIL:
if (island == null) {
if (!Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
return;
}
if (!island.getIgsFlag(SettingsFlag.PLACE_BLOCKS)) {
if (e.getMaterial() == Material.MINECART || e.getMaterial() == Material.STORAGE_MINECART || e.getMaterial() == Material.HOPPER_MINECART || e.getMaterial() == Material.EXPLOSIVE_MINECART || e.getMaterial() == Material.POWERED_MINECART) {
e.setCancelled(true);
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.getPlayer().updateInventory();
return;
}
}
case BEACON:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.BEACON)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.BEACON)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case CAKE_BLOCK:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.getPlayer().setFoodLevel(e.getPlayer().getFoodLevel() - 2);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.BREAK_BLOCKS)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.getPlayer().setFoodLevel(e.getPlayer().getFoodLevel() - 2);
e.setCancelled(true);
return;
}
break;
case DRAGON_EGG:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.BREAK_BLOCKS)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case MOB_SPAWNER:
if (island == null) {
if (Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
return;
}
 else {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
if (!island.getIgsFlag(SettingsFlag.BREAK_BLOCKS)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
break;
case BED_BLOCK:
if (e.getPlayer().getWorld().getEnvironment().equals(Environment.NETHER)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
default :
break;
}
}
if (DEBUG) {
plugin.getLogger().info("String_Node_Str" + e.getMaterial());
plugin.getLogger().info("String_Node_Str" + Util.getPlayerInHandItems(e.getPlayer()));
}
if (e.getMaterial() != null) {
if (e.getMaterial() == Material.WOOD_DOOR || e.getMaterial() == Material.CHEST || e.getMaterial() == Material.TRAPPED_CHEST || e.getMaterial() == Material.IRON_DOOR) {
if ((island == null && Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) || (island != null && !island.getIgsFlag(SettingsFlag.PLACE_BLOCKS))) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
e.getPlayer().updateInventory();
return;
}
}
 else if (e.getMaterial().name().contains("String_Node_Str") && (e.getClickedBlock() != null && !e.getClickedBlock().isLiquid())) {
if ((island == null && Settings.defaultWorldSettings.get(SettingsFlag.PLACE_BLOCKS)) || (island != null && !island.getIgsFlag(SettingsFlag.PLACE_BLOCKS))) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
return;
}
}
 else if (e.getMaterial().equals(Material.ENDER_PEARL)) {
if ((island == null && Settings.defaultWorldSettings.get(SettingsFlag.ENDER_PEARL)) || (island != null && !island.getIgsFlag(SettingsFlag.ENDER_PEARL))) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
return;
}
 else if (e.getMaterial().equals(Material.FLINT_AND_STEEL)) {
plugin.getLogger().info("String_Node_Str");
if (e.getClickedBlock() != null) {
if (e.getMaterial().equals(Material.OBSIDIAN)) {
plugin.getLogger().info("String_Node_Str");
}
if (!actionAllowed(e.getPlayer(),e.getClickedBlock().getLocation(),SettingsFlag.FIRE)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
}
return;
}
 else if (e.getMaterial().equals(Material.MONSTER_EGG)) {
if (DEBUG) plugin.getLogger().info("String_Node_Str" + island.getIgsFlag(SettingsFlag.SPAWN_EGGS));
if (!actionAllowed(e.getPlayer(),e.getClickedBlock().getLocation(),SettingsFlag.SPAWN_EGGS)) {
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
return;
}
 else if (e.getMaterial().equals(Material.POTION) && e.getItem().getDurability() != 0) {
try {
Potion p=Potion.fromItemStack(e.getItem());
if (p.isSplash()) {
boolean inNether=false;
if (e.getPlayer().getWorld().equals(ASkyBlock.getNetherWorld())) {
inNether=true;
}
if (island == null) {
if ((inNether && Settings.defaultWorldSettings.get(SettingsFlag.NETHER_PVP) || (!inNether && Settings.defaultWorldSettings.get(SettingsFlag.PVP)))) {
return;
}
}
 else {
if ((inNether && island.getIgsFlag(SettingsFlag.NETHER_PVP) || (!inNether && island.getIgsFlag(SettingsFlag.PVP)))) {
return;
}
}
Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
}
 catch (Exception ex) {
}
}
}
}