title: Inventory ClickEvent not working
body: <p>When I click the Item in the Inventory, it simply does nothing and I can drag it anywhere I want. Then I re-open the inventory and the Item is back. I want the item a click (The Notify item in this case) to toggle the notify boolean and close the Inventory. Please help. It may be a stupid solution but sometimes the simple stuff can escape me. Thanks.</p>
  
  <p>This is the Inventory:</p>
  
  <pre><code>public class GUI extends JavaPlugin implements Listener
  {
  
      private API api;
  
      AlphaCommand command = new AlphaCommand();
  
      public static Inventory inv = Bukkit.createInventory(null, 9, ChatColor.AQUA + "Alpha Config");
  
        public static boolean isNotifyEnabled()
        {
          return AlphaCommand.notify;
        }
  
        protected String getCheckName()
        {
          return this.getCheckName();
        }
  
      public static void openGUI(Player player, Inventory inv)
      {   
          ItemStack checks = new ItemStack(Material.DIAMOND_SWORD);
          ItemStack banPlayer = new ItemStack(Material.GOLD_AXE);
          ItemStack autoBan = new ItemStack(Material.DIAMOND_AXE);
          ItemStack notify = new ItemStack(Material.SLIME_BALL);
  
          ItemMeta checksMeta = checks.getItemMeta();
          ItemMeta autoBanMeta = autoBan.getItemMeta();
          ItemMeta notifyMeta = notify.getItemMeta();
          ItemMeta banPlayerMeta = banPlayer.getItemMeta();
  
  
          checksMeta.setDisplayName(ChatColor.BLUE + "Checks");
          autoBanMeta.setDisplayName(ChatColor.BLUE + "AutoBan");
          notifyMeta.setDisplayName(ChatColor.BLUE + "Notify");
          banPlayerMeta.setDisplayName(ChatColor.BLUE + "Ban Player");
  
  
          checks.setItemMeta(checksMeta);
          autoBan.setItemMeta(autoBanMeta);
          notify.setItemMeta(notifyMeta);
          banPlayer.setItemMeta(banPlayerMeta);
  
  
          inv.setItem(7, banPlayer);  
          inv.setItem(1, checks);
          inv.setItem(3, autoBan);
          inv.setItem(5, notify);
  
          player.openInventory(inv);
  
      }
  
      public static void open(Player player, Inventory inv)
      {
          if(player instanceof Player)
          {
              player.openInventory(inv);
          }
  
      }
      public static Inventory getGUI(){
          return inv;
          }
  
      @EventHandler
      public void onInventoryClick(InventoryClickEvent e)
      {
          Bukkit.getPluginManager().registerEvents(this, Bukkit.getPluginManager().getPlugins()[0]);
          String invName = ChatColor.stripColor(e.getClickedInventory().getName());
  
          Player player = (Player) e.getWhoClicked(); // The player that clicked the item
          ItemStack clicked = e.getCurrentItem(); // The item that was clicked
          @SuppressWarnings("unused")
          Inventory inventory = e.getInventory(); // The inventory that was clicked in
  
      if(invName.equalsIgnoreCase(inv.getName()))
      {
  
          if((clicked == null) || (clicked.getType() == Material.AIR) || (!clicked.hasItemMeta()))
          {
              player.closeInventory();
              return;
          }
  
          if(clicked.getItemMeta().getDisplayName().equalsIgnoreCase("AutoBan"))
          {
              Configuration config = this.api.getConfiguration();
              boolean autoBan = config.readBoolean("checks." + getCheckName() + ".AutoBan");
  
              if (config.readBoolean("checks." + getCheckName() + ".AutoBan") == true)
              {
                   autoBan = false;
                   e.setCancelled(true);
                   player.closeInventory();
                   return;
              }
              else if(autoBan == false)
              {
                  autoBan = true;
                  e.setCancelled(true);
                  player.closeInventory();
                  return;
              }
              else
              {
                  e.setCancelled(true);
                  player.closeInventory();
                  return;
              }
          }
  
          if(clicked.getItemMeta().getDisplayName().equalsIgnoreCase("Notify"))
          {
              boolean notify = isNotifyEnabled();
  
              if(notify == true)
              {
                  notify = false;
                  e.setCancelled(true);
                  player.closeInventory();
                  return;
              }
              else if(notify == false)
              {
                  notify = true;
                  e.setCancelled(true);
                  player.closeInventory();
                  return;
              }
          }
  
          if(clicked.getItemMeta().getDisplayName().equalsIgnoreCase("Checks"))
          {
              player.sendMessage(ChatColor.RED + "This Feature is coming soon to Alpha.");
              e.setCancelled(true);
              player.closeInventory();
              return;
          }
  
          if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("Ban Player"))
          {
              player.sendMessage("This Feature is coming soon to Alpha V.4");
              e.setCancelled(true);
              player.closeInventory();
              return;
  
          }else
              {
              player.closeInventory();
              e.setCancelled(true);
              return;
              }
  
          }
      }
  
  }
  </code></pre>