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