@@ -0,0 +1,2486 @@
+/*%0A * Copyright (c) 2013 - 2015 xxyy (Philipp Nowak; devnull@nowak-at.net). All rights reserved.%0A *%0A * Any usage, including, but not limited to, compiling, running, redistributing, printing,%0A *  copying and reverse-engineering is strictly prohibited without explicit written permission%0A *  from the original author and may result in legal steps being taken.%0A *%0A * See the included LICENSE file (core/src/main/resources) or email xxyy98+xyclicense@gmail.com for details.%0A */%0A%0Apackage li.l1t.common.inventory.gui;%0A%0Aimport com.google.common.base.Preconditions;%0Aimport li.l1t.common.inventory.gui.element.MenuElement;%0Aimport org.bukkit.entity.Player;%0Aimport org.bukkit.plugin.Plugin;%0A%0A/**%0A * An inventory menu that behaves just like %7B@link SimpleInventoryMenu%7D, but also provides a%0A * dedicated API for providing control buttons in the topmost row of the inventory. The top row is%0A * filled with placeholders by default.%0A *%0A * @author %3Ca href=%22http://xxyy.github.io/%22%3Exxyy%3C/a%3E%0A * @since 2016-08-15%0A */%0Apublic abstract class TopRowInventoryMenu extends SimpleInventoryMenu %7B%0A    /**%0A     * Creates a new abstract inventory menu.%0A     *%0A     * @param plugin         the plugin associated with this menu, may not be null%0A     * @param inventoryTitle the title of the inventory, may not be null%0A     * @param player         the player associated with this menu, may not be null%0A     */%0A    protected TopRowInventoryMenu(Plugin plugin, String inventoryTitle, Player player) %7B%0A        super(plugin, inventoryTitle, player);%0A        prefillTopRow();%0A        initTopRow();%0A    %7D%0A%0A    /**%0A     * Initialises the top row with buttons. By default, all slots of the top row are already filled%0A     * with placeholders before this method is called. This method is called once from the%0A     * constructor.%0A     */%0A    protected abstract void initTopRow();%0A%0A    private void prefillTopRow() %7B%0A        for (int i = 0; i %3C ROW_SIZE; i++) %7B%0A            addPlaceholder(i);%0A        %7D%0A    %7D%0A%0A    /**%0A     * Adds an element to the top row.%0A     *%0A     * @param slotId  the index in the top row of the element%0A     * @param element the element%0A     * @throws IllegalArgumentException if the slotId is not in the top row%0A     */%0A    public void addToTopRow(int slotId, MenuElement%3C? extends TopRowInventoryMenu%3E element) %7B%0A        Preconditions.checkArgument(slotId %3E= 0 && slotId %3C 9,%0A                %22slotId must be positive and less than 10, given: %25s%22, slotId);%0A        setElementRaw(slotId, element);%0A    %7D%0A%7D%0A

Add TopRowInventoryMenu for menus with a top button row