Package valorless.havenbags.gui
Class AdminGUI
java.lang.Object
valorless.havenbags.gui.AdminGUI
- All Implemented Interfaces:
org.bukkit.event.Listener
AdminGUI class for managing Haven Bags through a graphical user interface.
This class allows admins to create, restore, preview, delete, and manage bags of players.
It implements the Listener interface to handle various inventory events.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAdminGUI
(AdminGUI.GUIType type, org.bukkit.entity.Player player) Constructor for AdminGUI without a target player.AdminGUI
(AdminGUI.GUIType type, org.bukkit.entity.Player player, org.bukkit.OfflinePlayer target) Constructor for AdminGUI with a target OfflinePlayer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
modifyMaxStack
(org.bukkit.inventory.ItemStack item, int amount) void
onInventoryClick
(org.bukkit.event.inventory.InventoryClickEvent e) void
onInventoryClose
(org.bukkit.event.inventory.InventoryCloseEvent e) Handles the inventory close event.void
onPlayerCommand
(org.bukkit.event.player.PlayerCommandPreprocessEvent e) void
OpenInventory
(org.bukkit.entity.HumanEntity ent)
-
Field Details
-
plugin
public org.bukkit.plugin.java.JavaPlugin plugin
-
-
Constructor Details
-
AdminGUI
Constructor for AdminGUI without a target player. This constructor initializes the GUI for an admin to manage their own bags.- Parameters:
type
- The type of GUI to open (e.g., Main, Creation, Restoration).player
- The player who is opening the GUI.
-
AdminGUI
public AdminGUI(AdminGUI.GUIType type, org.bukkit.entity.Player player, org.bukkit.OfflinePlayer target) Constructor for AdminGUI with a target OfflinePlayer. This constructor initializes the GUI for an admin to manage bags of a specific player.- Parameters:
type
- The type of GUI to open (e.g., Main, Creation, Restoration).player
- The player who is opening the GUI.target
- The OfflinePlayer whose bags are being managed.
-
-
Method Details
-
OpenInventory
public void OpenInventory(org.bukkit.entity.HumanEntity ent) -
onInventoryClose
public void onInventoryClose(org.bukkit.event.inventory.InventoryCloseEvent e) Handles the inventory close event. This method checks if the closed inventory is the one managed by this GUI. If it is, it resets the type to PreviewPlayer and reloads the GUI after a short delay.- Parameters:
e
- The InventoryCloseEvent triggered when a player closes an inventory.
-
onPlayerCommand
public void onPlayerCommand(org.bukkit.event.player.PlayerCommandPreprocessEvent e) -
onInventoryClick
public void onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent e) -
modifyMaxStack
public void modifyMaxStack(org.bukkit.inventory.ItemStack item, int amount)
-