Class AnvilGui
java.lang.Object
com.github.stefvanschie.inventoryframework.gui.type.util.Gui
com.github.stefvanschie.inventoryframework.gui.type.util.NamedGui
com.github.stefvanschie.inventoryframework.gui.type.AnvilGui
- All Implemented Interfaces:
InventoryBased,org.bukkit.inventory.InventoryHolder
Represents a gui in the form of an anvil
- Since:
- 0.8.0
-
Field Summary
Fields inherited from class com.github.stefvanschie.inventoryframework.gui.type.util.Gui
humanEntityCache, inventory, onBottomClick, onBottomDrag, onClose, onGlobalClick, onGlobalDrag, onOutsideClick, onTopClick, onTopDrag -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclick(@NotNull org.bukkit.event.inventory.InventoryClickEvent event)This should delegate the provided inventory click event to the right pane, which can then handle this click event further.@NotNull AnvilGuicopy()Makes a copy of this gui and returns it.@NotNull org.bukkit.inventory.InventoryCreates a new inventory of the type of the implementing class.@NotNull InventoryComponentGets the inventory component representing the first item@NotNull org.bukkit.inventory.Inventory@NotNull InventoryComponentGets the inventory component representing the player inventory@NotNull StringGets the rename text currently specified in the anvil.@NotNull InventoryComponentGets the inventory component representing the result@NotNull InventoryComponentGets the inventory component representing the second itemintGets the count ofHumanEntityinstances that are currently viewing this GUI.@NotNull List<org.bukkit.entity.HumanEntity>Gets a mutable snapshot of the currentHumanEntityviewers of this GUI.voidhandleClickEvent(@NotNull org.bukkit.event.inventory.InventoryClickEvent event)Handles an incoming inventory click eventvoidhandleClose(@NotNull org.bukkit.entity.HumanEntity humanEntity)Handles a human entity closing this gui.booleanGets whether the player inventory is currently in use.static @Nullable AnvilGuiload(@NotNull Object instance, @NotNull InputStream inputStream)Loads an anvil gui from an XML file.static @NotNull AnvilGuiLoads an anvil gui from the specified element, applying code references to the provided instance.voidshow(@NotNull org.bukkit.entity.HumanEntity humanEntity)Shows a gui to a playerMethods inherited from class com.github.stefvanschie.inventoryframework.gui.type.util.NamedGui
getTitle, getTitleHolder, isDirty, markChanges, setTitle, setTitleMethods inherited from class com.github.stefvanschie.inventoryframework.gui.type.util.Gui
addInventory, callOnBottomClick, callOnBottomDrag, callOnClose, callOnGlobalClick, callOnGlobalDrag, callOnOutsideClick, callOnTopClick, callOnTopDrag, getGui, getHumanEntityCache, initializeOrThrow, isUpdating, loadPane, registerGui, registerPane, registerProperty, setOnBottomClick, setOnBottomDrag, setOnClose, setOnGlobalClick, setOnGlobalDrag, setOnOutsideClick, setOnTopClick, setOnTopDrag, update
-
Constructor Details
-
AnvilGui
Constructs a new anvil gui- Parameters:
title- the title/name of this gui.- Since:
- 0.8.0
-
AnvilGui
public AnvilGui(@NotNull @NotNull com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder title)Constructs a new anvil gui- Parameters:
title- the title/name of this gui.- Since:
- 0.10.0
-
-
Method Details
-
show
public void show(@NotNull @NotNull org.bukkit.entity.HumanEntity humanEntity)Description copied from class:GuiShows a gui to a player -
copy
Description copied from class:GuiMakes a copy of this gui and returns it. This makes a deep copy of the gui. This entails that the underlying panes will be copied as per theirPane.copy()and miscellaneous data will be copied. The copy of this gui, will however have no viewers even if this gui currently has viewers. With this, cache data for viewers will also be non-existent for the copied gui. The returned gui will never be reference equal to the current gui. -
click
public void click(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent event)Description copied from class:GuiThis should delegate the provided inventory click event to the right pane, which can then handle this click event further. This should not call any internal click handlers, since those will already have been activated. -
getInventory
@NotNull public @NotNull org.bukkit.inventory.Inventory getInventory()- Specified by:
getInventoryin interfaceorg.bukkit.inventory.InventoryHolder
-
createInventory
@NotNull @Contract(pure=true) public @NotNull org.bukkit.inventory.Inventory createInventory()Description copied from interface:InventoryBasedCreates a new inventory of the type of the implementing class.- Specified by:
createInventoryin interfaceInventoryBased- Returns:
- the new inventory
-
getRenameText
Gets the rename text currently specified in the anvil.- Returns:
- the rename text
- Since:
- 0.8.0
- See Also:
AnvilInventory.getRenameText()
-
isPlayerInventoryUsed
@Contract(pure=true) public boolean isPlayerInventoryUsed()Description copied from class:GuiGets whether the player inventory is currently in use. This means whether the player inventory currently has an item in it.- Specified by:
isPlayerInventoryUsedin classGui- Returns:
- true if the player inventory is occupied, false otherwise
-
getViewerCount
@Contract(pure=true) public int getViewerCount()Description copied from class:GuiGets the count ofHumanEntityinstances that are currently viewing this GUI.- Specified by:
getViewerCountin classGui- Returns:
- the count of viewers
-
getViewers
Description copied from class:GuiGets a mutable snapshot of the currentHumanEntityviewers of this GUI. This is a snapshot (copy) and not a view, therefore modifications aren't visible.- Specified by:
getViewersin classGui- Returns:
- a snapshot of the current viewers
- See Also:
Gui.getViewerCount()
-
handleClickEvent
public void handleClickEvent(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent event)Handles an incoming inventory click event- Parameters:
event- the event to handle- Since:
- 0.8.0
-
handleClose
public void handleClose(@NotNull @NotNull org.bukkit.entity.HumanEntity humanEntity)Handles a human entity closing this gui.- Parameters:
humanEntity- the human entity closing the gui- Since:
- 0.10.1
-
getFirstItemComponent
Gets the inventory component representing the first item- Returns:
- the first item component
- Since:
- 0.8.0
-
getSecondItemComponent
Gets the inventory component representing the second item- Returns:
- the second item component
- Since:
- 0.8.0
-
getResultComponent
Gets the inventory component representing the result- Returns:
- the result component
- Since:
- 0.8.0
-
getPlayerInventoryComponent
Gets the inventory component representing the player inventory- Returns:
- the player inventory component
- Since:
- 0.8.0
-
load
@Nullable @Contract(pure=true) public static @Nullable AnvilGui load(@NotNull @NotNull Object instance, @NotNull @NotNull InputStream inputStream)Loads an anvil gui from an XML file.- Parameters:
instance- the instance on which to reference fields and methodsinputStream- the input stream containing the XML data- Returns:
- the loaded anvil gui
- Since:
- 0.8.0
-
load
@NotNull public static @NotNull AnvilGui load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element)Loads an anvil gui from the specified element, applying code references to the provided instance.- Parameters:
instance- the instance on which to reference fields and methodselement- the element to load the gui from- Returns:
- the loaded anvil gui
- Since:
- 0.8.0
-