org.bukkit.event.inventory.InventoryClickEvent Java Examples

The following examples show how to use org.bukkit.event.inventory.InventoryClickEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CutCleanListener.java    From UhcCore with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onInventoryClick(InventoryClickEvent e){
    Inventory inv = e.getInventory();
    ItemStack item = e.getCurrentItem();
    if (!unlimitedLapis) return;
    if (inv == null || item == null) return;

    if (inv instanceof EnchantingInventory){

        if (item.getType().equals(lapis.getType())){
            e.setCancelled(true);
        }else {
            e.getInventory().setItem(1, lapis);
        }
    }
}
 
Example #2
Source File: SprintingPattern.java    From AACAdditionPro with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected int process(User user, InventoryClickEvent event)
{
    // Flight may trigger this
    if (!user.getPlayer().getAllowFlight() &&
        // Not using an Elytra
        !EntityUtil.isFlyingWithElytra(user.getPlayer()) &&
        // Sprinting and Sneaking as detection
        (user.getPlayer().isSprinting() || user.getPlayer().isSneaking()) &&
        // The player opened the inventory at least a quarter second ago
        user.notRecentlyOpenedInventory(250) &&
        // Is the player moving
        user.hasMovedRecently(TimestampKey.LAST_HEAD_OR_OTHER_MOVEMENT, 1000))
    {
        message = "Inventory-Verbose | Player: " + user.getPlayer().getName() + " interacted with an inventory while sprinting or sneaking.";
        return 20;
    }
    return 0;
}
 
Example #3
Source File: AnvilGUI.java    From AnvilGUI with MIT License 6 votes vote down vote up
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
	if (
		((event.getInventory().equals(inventory)) && (event.getRawSlot() < 3)) ||
		(event.getAction().equals(InventoryAction.MOVE_TO_OTHER_INVENTORY)) ||
		((event.getRawSlot() < 3) && ((event.getAction().equals(InventoryAction.PLACE_ALL)) || (event.getAction().equals(InventoryAction.PLACE_ONE)) || (event.getAction().equals(InventoryAction.PLACE_SOME)) || (event.getCursor() != null)))
	){
		event.setCancelled(true);
		final Player clicker = (Player) event.getWhoClicked();
		if (event.getRawSlot() == Slot.OUTPUT) {
			final ItemStack clicked = inventory.getItem(Slot.OUTPUT);
			if (clicked == null || clicked.getType() == Material.AIR) return;

			final Response response = completeFunction.apply(clicker, clicked.hasItemMeta() ? clicked.getItemMeta().getDisplayName() : "");
			if(response.getText() != null) {
				final ItemMeta meta = clicked.getItemMeta();
				meta.setDisplayName(response.getText());
				clicked.setItemMeta(meta);
				inventory.setItem(Slot.INPUT_LEFT, clicked);
			} else {
				closeInventory();
			}
		}
	}
}
 
Example #4
Source File: InventoryForPassengers.java    From NBTEditor with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void inventoryClick(InventoryClickEvent event) {
	super.inventoryClick(event);
	ItemStack item = event.getCurrentItem();
	if (item != null && item.getType() != Material.AIR) {
		Player player = (Player) event.getWhoClicked();
		if (item.equals(((EntityNBT) _wrapper)._bos.getBook())) {
			event.setCancelled(true);
		} else if (!BookOfSouls.isValidBook(item)) {
			event.setCancelled(true);
			player.sendMessage("§cYou can only put Books of Souls.");
		} else {
			EntityNBT entityNbt = BookOfSouls.bookToEntityNBT(item);
			if (entityNbt == null) {
				player.sendMessage("§cThat Book of Souls is corrupted!");
				event.setCancelled(true);
			}
		}
	}
}
 
Example #5
Source File: ItemFilter.java    From Minepacks with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onItemClick(InventoryClickEvent event)
{
	if(!(event.getWhoClicked() instanceof Player)) return;
	if(event.getInventory().getHolder() instanceof Backpack)
	{
		Player player = (Player) event.getWhoClicked();
		if(event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY && checkIsBlockedAndShowMessage(player, event.getCurrentItem()))
		{
			event.setCancelled(true);
		}
		else if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.getAction() == InventoryAction.HOTBAR_SWAP) && event.getHotbarButton() != -1)
		{
			ItemStack item = event.getWhoClicked().getInventory().getItem(event.getHotbarButton());
			if(checkIsBlockedAndShowMessage(player, item))
			{
				event.setCancelled(true);
			}
		}
		else if(!player.getInventory().equals(event.getClickedInventory()) && checkIsBlockedAndShowMessage(player, event.getCursor()))
		{
			event.setCancelled(true);
		}
	}
}
 
Example #6
Source File: DataUpdaterEvents.java    From AACAdditionPro with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.LOW)
public void onInventoryClick(final InventoryClickEvent event)
{
    final User user = UserManager.getUser(event.getWhoClicked().getUniqueId());

    if (user != null &&
        // Quickbar actions can be performed outside the inventory.
        event.getSlotType() != InventoryType.SlotType.QUICKBAR)
    {
        // Only update if the inventory is currently closed to not interfere with opening time checks.
        if (!user.hasOpenInventory()) {
            user.getTimestampMap().updateTimeStamp(TimestampKey.INVENTORY_OPENED);
        }

        user.getTimestampMap().updateTimeStamp(TimestampKey.LAST_INVENTORY_CLICK);
        if (event.getCurrentItem() != null) {
            user.getTimestampMap().updateTimeStamp(TimestampKey.LAST_INVENTORY_CLICK_ON_ITEM);
        }

        user.getDataMap().setValue(DataKey.LAST_RAW_SLOT_CLICKED, event.getRawSlot());
        user.getDataMap().setValue(DataKey.LAST_MATERIAL_CLICKED, event.getCurrentItem() == null ?
                                                                  Material.AIR :
                                                                  event.getCurrentItem().getType());
    }
}
 
Example #7
Source File: VanillaMachinesListener.java    From Slimefun4 with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void onGrindstone(InventoryClickEvent e) {
    // The Grindstone was only ever added in MC 1.14
    MinecraftVersion minecraftVersion = SlimefunPlugin.getMinecraftVersion();
    if (!minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
        return;
    }

    if (e.getRawSlot() == 2 && e.getWhoClicked() instanceof Player && e.getInventory().getType() == InventoryType.GRINDSTONE) {
        ItemStack item1 = e.getInventory().getContents()[0];
        ItemStack item2 = e.getInventory().getContents()[1];

        if (checkForUnallowedItems(item1, item2)) {
            e.setResult(Result.DENY);
        }
    }

}
 
Example #8
Source File: KitLoading.java    From AnnihilationPro with MIT License 6 votes vote down vote up
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled=true)
public void StopClicking(InventoryClickEvent event)
{
    HumanEntity entity = event.getWhoClicked();
    ItemStack stack = event.getCurrentItem();
    InventoryType top = event.getView().getTopInventory().getType();
    
    if (stack != null && (entity instanceof Player)) 
    {
    	if (top == InventoryType.PLAYER || top == InventoryType.WORKBENCH || top == InventoryType.CRAFTING) 
    		return;

    	if(KitUtils.isSoulbound(stack))
          event.setCancelled(true); 
    }
 }
 
Example #9
Source File: ItemListener.java    From HubBasics with GNU Lesser General Public License v3.0 6 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void onItemMove(InventoryClickEvent event) {
    ItemStack currentItem = event.getCurrentItem();
    if (currentItem == null || currentItem.getType() == Material.AIR) return;
    NBTItem nbtItem = new NBTItem(currentItem);
    if (!nbtItem.hasKey("HubBasics")) return;

    CustomItem item = HubBasics.getInstance().getItemManager().get(nbtItem.getString("HubBasics"));
    if (item == null) {
        currentItem.setType(Material.AIR); // Destroy old item
        return;
    }
    if (item.getRunOnInventory()) {
        item.onCommand((Player) event.getWhoClicked());
    }
    if (!item.getAllowMove())
        event.setCancelled(true); // Call setCancelled only when needed to not conflict with other plugins
}
 
Example #10
Source File: PlayerShopkeeper.java    From Shopkeepers with GNU General Public License v3.0 6 votes vote down vote up
protected void handleUpdateItemAmountOnClick(InventoryClickEvent event, int minAmount) {
	// cancel event:
	event.setCancelled(true);
	// ignore in certain situations:
	ItemStack clickedItem = event.getCurrentItem();
	if (Utils.isEmpty(clickedItem)) return;

	// get new item amount:
	int currentItemAmount = clickedItem.getAmount();
	if (minAmount <= 0) minAmount = 0;
	int newItemAmount = this.getNewAmountAfterEditorClick(event, currentItemAmount, minAmount, clickedItem.getMaxStackSize());
	assert newItemAmount >= minAmount;
	assert newItemAmount <= clickedItem.getMaxStackSize();

	// update item in inventory:
	if (newItemAmount == 0) {
		// empty item slot:
		event.setCurrentItem(null);
	} else {
		clickedItem.setAmount(newItemAmount);
	}
}
 
Example #11
Source File: AdventurersGuildGUI.java    From EliteMobs with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onMainMenuClick(InventoryClickEvent event) {

    if (!(event.getWhoClicked() instanceof Player)) return;
    if (!event.getInventory().getName().equalsIgnoreCase("Adventurer's guild")) return;
    if (event.getCurrentItem() == null || event.getCurrentItem().getType().equals(Material.AIR)) return;
    if (event.getCurrentItem().equals(difficulty))
        difficultyMenu((Player) event.getWhoClicked());
    if (event.getCurrentItem().equals(quest)) {
        event.getWhoClicked().closeInventory();
        event.getWhoClicked().sendMessage("Coming soon!");
    }

    event.setCancelled(true);

}
 
Example #12
Source File: BlockListeners.java    From CratesPlus with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
    if (!cratesPlus.getConfigHandler().isDisableKeySwapping() || event.getView().getTitle().equals("Claim Crate Keys"))
        return;
    if (!event.getInventory().getType().toString().contains("PLAYER") && event.getCurrentItem() != null) {
        String title;
        ItemStack item = event.getCurrentItem();
        for (Map.Entry<String, Crate> crate : cratesPlus.getConfigHandler().getCrates().entrySet()) {
            if (!(crate.getValue() instanceof KeyCrate)) {
                continue;
            }
            KeyCrate keyCrate = (KeyCrate) crate.getValue();
            Key key = keyCrate.getKey();
            if (key == null)
                continue;
            title = key.getName();

            if (item.hasItemMeta() && item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().contains(title)) {
                // Send message?
                event.setCancelled(true);
                return;
            }
        }
    }
}
 
Example #13
Source File: IconInventory.java    From UHC with MIT License 6 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void on(InventoryClickEvent event) {
    final Inventory inventory = event.getInventory();
    if (!inventory.getTitle().equals(title)) return;

    event.setCancelled(true);

    final int slot = event.getRawSlot();

    if (slot < 0 || slot >= inventory.getSize() || slot >= icons.size()) return;

    // call event
    final IconStack icon = icons.get(slot);

    if (icon != null) {
        icon.onClick((Player) event.getWhoClicked());
    }
}
 
Example #14
Source File: PlayerListener.java    From BedWars with GNU Lesser General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
    if (event.isCancelled()) {
        return;
    }

    if (event.getClickedInventory() == null) {
        return;
    }

    if (event.getClickedInventory().getType() == InventoryType.PLAYER) {
        Player p = (Player) event.getWhoClicked();
        if (Main.isPlayerInGame(p)) {
            GamePlayer gPlayer = Main.getPlayerGameProfile(p);
            Game game = gPlayer.getGame();
            if (game.getStatus() == GameStatus.WAITING || gPlayer.isSpectator) {
                event.setCancelled(true);
            }
        }
    }
}
 
Example #15
Source File: ObserverToolsMatchModule.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void onInventoryClick(final InventoryClickEvent event) {
  if (event.getCurrentItem() == null
      || event.getCurrentItem().getItemMeta() == null
      || event.getCurrentItem().getItemMeta().getDisplayName() == null) return;

  if (event.getWhoClicked() instanceof Player) {
    MatchPlayer player = match.getPlayer(event.getWhoClicked());
    if (menu.isViewing(player)) {
      ItemStack clicked = event.getCurrentItem();
      menu.getTools()
          .forEach(
              tool -> {
                if (clicked.getType().equals(tool.getMaterial(player))) {
                  tool.onInventoryClick(menu, player, event.getClick());
                }
              });
    }
  }
}
 
Example #16
Source File: LoreGuiItemListener.java    From civcraft with GNU General Public License v2.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.LOW)
public void OnInventoryClickSecondPhase(InventoryClickEvent event) {
	if (event.isCancelled()) {
		return;
	}
	
	if (event.getRawSlot() < event.getView().getTopInventory().getSize()) {
		if (guiInventories.containsKey(event.getView().getTopInventory().getName())) {
			event.setCancelled(true);
			return;
		}
	} else if (event.isShiftClick()) {
		if (guiInventories.containsKey(event.getView().getTopInventory().getName())) {
			event.setCancelled(true);
			return;
		}			
	}
	
}
 
Example #17
Source File: CivilianTests.java    From Civs with GNU General Public License v3.0 6 votes vote down vote up
@Test(expected = SuccessException.class)
    @Ignore
    public void inventoryClickOnUnownedCivItemShouldBeCancelled() {
        InventoryClickEvent event = mock(InventoryClickEvent.class);
        ItemStack is = TestUtil.createUniqueItemStack(Material.CHEST, "Civs Cobble");
        when(event.getCurrentItem()).thenReturn(is);
        Inventory inventory = mock(Inventory.class);
        when(event.getClickedInventory()).thenReturn(inventory);
        Player player = mock(Player.class);
        UUID uuid = new UUID(1,8);
        when(player.getUniqueId()).thenReturn(uuid);
        when(event.getWhoClicked()).thenReturn(player);
        doThrow(new SuccessException()).when(event).setCancelled(true);

        CivilianListener civilianListener = new CivilianListener();
//        civilianListener.onInventoryMoveEvent(event);
        fail("set cancelled not called");
    }
 
Example #18
Source File: AnvilRenameListener.java    From MineableSpawners with MIT License 6 votes vote down vote up
@EventHandler (ignoreCancelled = true)
public void onAnvilRename(InventoryClickEvent e) {
  if (e.getInventory() == null || e.getInventory().getType() == null) {
    return;
  }

  if (e.getCurrentItem() == null || e.getCurrentItem().getType() == null) {
    return;
  }

  if (e.getInventory().getType() != InventoryType.ANVIL || e.getCurrentItem().getType() != XMaterial.SPAWNER.parseMaterial()) {
    return;
  }

  if (!plugin.getConfigurationHandler().getBoolean("anvil", "prevent-anvil")) {
    return;
  }

  Player player = (Player) e.getWhoClicked();
  e.setCancelled(true);
  player.sendMessage(plugin.getConfigurationHandler().getMessage("anvil", "prevented"));
}
 
Example #19
Source File: TestVanillaMachinesListener.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testGrindStoneWithSlimefunItem() {
    SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "ENCHANTED_MOCK_BOOK", new CustomItem(Material.ENCHANTED_BOOK, "&6Mock"));
    item.register(plugin);

    InventoryClickEvent event = mockGrindStoneEvent(item.getItem());
    Assertions.assertEquals(Result.DENY, event.getResult());
}
 
Example #20
Source File: SharedShopElements.java    From EliteMobs with GNU General Public License v3.0 5 votes vote down vote up
public static boolean sellInventoryNullPointerPreventer(InventoryClickEvent event) {

        //Check if economy is enabled
        if (!ConfigValues.economyConfig.getBoolean(EconomySettingsConfig.ENABLE_ECONOMY)) return false;
        //Check if current item is valid
        if (event.getCurrentItem() == null) return false;
        return !event.getCurrentItem().getType().equals(Material.AIR);
    }
 
Example #21
Source File: IntegerEditMenu.java    From uSkyBlock with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onClick(InventoryClickEvent event) {
    if (!(event.getInventory().getHolder() instanceof UltimateHolder) ||
            ((UltimateHolder) event.getInventory().getHolder()).getTitle() == null ||
            !stripFormatting(((UltimateHolder) event.getInventory().getHolder()).getTitle()).contains(stripFormatting(getTitle()))) {
        return false;
    }
    if (event.getSlotType() != InventoryType.SlotType.CONTAINER) {
        return true;
    }
    Player player = (Player) event.getWhoClicked();
    Inventory menu = event.getInventory();
    ItemStack returnItem = menu.getItem(getIndex(5, 0));
    String configName = returnItem.getItemMeta().getLore().get(0);
    String path = returnItem.getItemMeta().getLore().get(1);
    int page = getPage(returnItem.getItemMeta().getLore().get(2));
    int slot = event.getSlot();
    int row = slot / 9;
    int col = slot % 9;
    ItemStack clickedItem = event.getCurrentItem();
    if (slot >= getIndex(3, 0) && slot <= getIndex(3, 8)) {
        // increment buttons
        YmlConfiguration config = FileUtil.getYmlConfiguration(configName);
        int value = config.getInt(path, 0);
        int increment = getDisplayNameAsInt(clickedItem);
        if (event.getClick() == ClickType.LEFT) {
            value += increment;
        } else if (event.getClick() == ClickType.RIGHT) {
            value = increment;
        }
        config.set(path, value);
        config.set("dirty", true);
    }
    if (slot != getIndex(5,0)) {
        player.openInventory(createEditMenu(configName, path, page));
    } else {
        player.openInventory(parent.createEditMenu(configName, path, page));
    }
    return true;
}
 
Example #22
Source File: MenuListener.java    From AmpMenus with GNU Lesser General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onInventoryClick(InventoryClickEvent event) {
    if (event.getWhoClicked() instanceof Player && event.getInventory().getHolder() instanceof MenuHolder) {
        event.setCancelled(true);
        ((MenuHolder) event.getInventory().getHolder()).getMenu().onInventoryClick(event);
    }
}
 
Example #23
Source File: DraggedItemReq.java    From black with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean control(final InventoryInteractEvent event) {
    if (event instanceof InventoryClickEvent) {
        return false;
    } else {
        return ((InventoryDragEvent) event).getOldCursor().equals(item);
    }
}
 
Example #24
Source File: Item.java    From helper with MIT License 5 votes vote down vote up
@Nonnull
public Builder bind(@Nonnull ClickType type, @Nullable Consumer<InventoryClickEvent> handler) {
    Objects.requireNonNull(type, "type");
    if (handler != null) {
        this.handlers.put(type, handler);
    } else {
        this.handlers.remove(type);
    }
    return this;
}
 
Example #25
Source File: TestVanillaMachinesListener.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testAnvilWithSlimefunItem() {
    SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "MOCKED_IRON_SWORD", new CustomItem(Material.IRON_SWORD, "&6Mock"));
    item.register(plugin);

    InventoryClickEvent event = mockAnvilEvent(item.getItem());
    Assertions.assertEquals(Result.DENY, event.getResult());
}
 
Example #26
Source File: Item.java    From helper with MIT License 5 votes vote down vote up
@Nonnull
public Builder bind(@Nullable Consumer<InventoryClickEvent> handler, @Nonnull ClickType... types) {
    for (ClickType type : types) {
        bind(type, handler);
    }
    return this;
}
 
Example #27
Source File: ClickTarget.java    From black with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handle(final InventoryInteractEvent event) {
    if (event instanceof InventoryClickEvent &&
            Arrays.stream(reqs).allMatch(req -> req.control(event))) {

        handler.accept(new ElementClickEvent((InventoryClickEvent) event));
    }
}
 
Example #28
Source File: TopTen.java    From askyblock with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled=true)
public void onInventoryClick(InventoryClickEvent event) {
    Inventory inventory = event.getInventory(); // The inventory that was clicked in
    if (inventory.getName() == null) {
        return;
    }
    // The player that clicked the item
    Player player = (Player) event.getWhoClicked();
    if (!inventory.getTitle().equals(plugin.myLocale().topTenGuiTitle)) {
        return;
    }
    event.setCancelled(true);
    player.updateInventory();
    if(event.getCurrentItem() != null && !event.getCurrentItem().getType().equals(Material.AIR) && event.getRawSlot() < 26) {
        event.getCurrentItem().setType(Material.AIR);
        player.closeInventory();
        String playerName = getPlayer(event.getRawSlot());
        UUID uuid = plugin.getPlayers().getUUID(playerName);
        if (uuid != null && plugin.getWarpSignsListener().getWarp(uuid) != null) {
            Util.runCommand(player, "is warp " + playerName);
        }
    }
    if (event.getSlotType().equals(SlotType.OUTSIDE)) {
        player.closeInventory();
        return;
    }
    if (event.getClick().equals(ClickType.SHIFT_RIGHT)) {
        player.closeInventory();
        return;
    }
}
 
Example #29
Source File: QuestItemHandler.java    From BetonQuest with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void onItemMove(final InventoryClickEvent event) {
    if (!(event.getWhoClicked() instanceof Player)) {
        return;
    }
    if (event.getWhoClicked().getGameMode() == GameMode.CREATIVE) {
        return;
    }
    final String playerID = PlayerConverter.getID((Player) event.getWhoClicked());
    ItemStack item;
    switch (event.getAction()) {
    case MOVE_TO_OTHER_INVENTORY:
        item = event.getCurrentItem();
        break;
    case PLACE_ALL:
    case PLACE_ONE:
    case PLACE_SOME:
    case SWAP_WITH_CURSOR:
        if (event.getClickedInventory().getType() != InventoryType.PLAYER) {
            item = event.getCursor();
        } else {
            item = null;
        }
        break;
    case HOTBAR_MOVE_AND_READD:
    case HOTBAR_SWAP:
        if (event.getClickedInventory().getType() != InventoryType.PLAYER) {
            item = event.getWhoClicked().getInventory().getItem(event.getHotbarButton());
        } else {
            item = null;
        }
        break;
    default:
        item = null;
        break;
    }
    if (item != null && (Journal.isJournal(playerID, item) || Utils.isQuestItem(item))) {
        event.setCancelled(true);
    }
}
 
Example #30
Source File: BuildStructureList.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
@Override
	public void performAction(InventoryClickEvent event, ItemStack stack) {
//		Player player = (Player)event.getWhoClicked();
//		Resident resident = CivGlobal.getResident(player);
//		Inventory guiInventory = Bukkit.getServer().createInventory(player, LoreGuiItem.MAX_INV_SIZE, "Pick Structure To Build");
//		
//		for (ConfigBuildableInfo info : CivSettings.structures.values()) {
//			int type = ItemManager.getId(Material.ANVIL);
//			if (info.itemTypeId != 0) {
//				type = info.itemTypeId;
//			}
//			
//			ItemStack is;
//			if (!resident.hasTown()) {
//				is = LoreGuiItem.build(info.displayName, ItemManager.getId(Material.BEDROCK), 0, CivColor.Rose+"Must belong to a town to build structures.");
//			} else {
//				if (!resident.getCiv().hasTechnology(info.require_tech)) {
//					ConfigTech tech = CivSettings.techs.get(info.require_tech);
//					is = LoreGuiItem.build(info.displayName, ItemManager.getId(Material.BEDROCK), 0, CivColor.Rose+"Requires: "+tech.name);
//				} else {
//					is = LoreGuiItem.build(info.displayName, type, info.itemData, CivColor.Gold+"<Click To Build>");
//					is = LoreGuiItem.setAction(is, "BuildChooseTemplate");
//					is = LoreGuiItem.setActionData(is, "info", info.id);
//				}
//			}
//			
//			guiInventory.addItem(is);
//		}
//		
//		
//		LoreGuiItemListener.guiInventories.put(guiInventory.getName(), guiInventory);		
//		TaskMaster.syncTask(new OpenInventoryTask(player, guiInventory));
	}