Allows using an existing item stack for an item factory
This commit is contained in:
		@@ -47,6 +47,11 @@ public abstract class AbstractGUI {
 | 
			
		||||
        instantiate(inventory);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets up an abstract GUI using the given inventory
 | 
			
		||||
     *
 | 
			
		||||
     * @param inventory <p>The inventory used for this GUI</p>
 | 
			
		||||
     */
 | 
			
		||||
    private void instantiate(Inventory inventory) {
 | 
			
		||||
        this.uuid = UUID.randomUUID();
 | 
			
		||||
        this.inventory = inventory;
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,6 @@ public class GUIRegistry {
 | 
			
		||||
     * @param autoDelete <p>Whether to immediately delete the closed GUI</p>
 | 
			
		||||
     */
 | 
			
		||||
    public static void closeGUI(Player player, boolean autoDelete) {
 | 
			
		||||
        //Run the close action if an anvil GUI is used
 | 
			
		||||
        AbstractGUI gui = getOpenGUI(player);
 | 
			
		||||
        //Un-register the player's open GUI
 | 
			
		||||
        openGUIs.remove(player.getUniqueId());
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,8 @@
 | 
			
		||||
package net.knarcraft.knargui;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Empty main class just in case something runs this directly
 | 
			
		||||
 */
 | 
			
		||||
@SuppressWarnings("unused")
 | 
			
		||||
public final class KnarGUI {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -30,4 +30,14 @@ public class GUIItemFactory extends AbstractGUIItemFactory<GUIItemFactory> {
 | 
			
		||||
        setChild(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a new item factory
 | 
			
		||||
     *
 | 
			
		||||
     * @param itemStack <p>The item stack to modify</p>
 | 
			
		||||
     */
 | 
			
		||||
    public GUIItemFactory(ItemStack itemStack) {
 | 
			
		||||
        super(itemStack);
 | 
			
		||||
        setChild(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user