Class PetsMenuCommand
java.lang.Object
com.storytimeproductions.stweaks.commands.PetsMenuCommand
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor
Command handler for the pets menu. This class manages the command to open the pets menu and
reloads the configuration if necessary.
It also provides methods to open the main pets menu and individual pet view menus.
-
Constructor Summary
ConstructorsConstructorDescriptionPetsMenuCommand
(org.bukkit.plugin.java.JavaPlugin plugin, PetsManager petsManager) Constructs the PetsMenuCommand. -
Method Summary
Modifier and TypeMethodDescriptionboolean
onCommand
(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) Executes the command to open the pets menu or reload the configuration.void
openMainPetsMenu
(org.bukkit.entity.Player player, int page) Opens the main pets menu for the player with pagination.void
openPetView
(org.bukkit.entity.Player player, Pet pet, int returnPage) Opens the detailed pet view menu for a specific pet.void
previewPet
(org.bukkit.entity.Player player, Pet pet) Previews a pet by playing a random sound and showing a random quote.
-
Constructor Details
-
PetsMenuCommand
Constructs the PetsMenuCommand.- Parameters:
plugin
- the main plugin instancepetsManager
- manager responsible for loading and accessing pet data
-
-
Method Details
-
onCommand
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) Executes the command to open the pets menu or reload the configuration.- Specified by:
onCommand
in interfaceorg.bukkit.command.CommandExecutor
- Parameters:
sender
- the command sendercommand
- the command being executedlabel
- the label of the commandargs
- the arguments passed to the command- Returns:
- true if the command was executed successfully, false otherwise
-
openMainPetsMenu
public void openMainPetsMenu(org.bukkit.entity.Player player, int page) Opens the main pets menu for the player with pagination.- Parameters:
player
- the player to whom the menu is displayedpage
- the current page number
-
openPetView
Opens the detailed pet view menu for a specific pet.- Parameters:
player
- the player to whom the menu is displayedpet
- the pet whose details are displayedreturnPage
- the page to return to when closing the pet view
-
previewPet
Previews a pet by playing a random sound and showing a random quote.- Parameters:
player
- the player who will see/hear the previewpet
- the pet to preview
-