Class PetsMenuCommand

java.lang.Object
com.storytimeproductions.stweaks.commands.PetsMenuCommand
All Implemented Interfaces:
org.bukkit.command.CommandExecutor

public class PetsMenuCommand extends Object implements 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

    Constructors
    Constructor
    Description
    PetsMenuCommand(org.bukkit.plugin.java.JavaPlugin plugin, PetsManager petsManager)
    Constructs the PetsMenuCommand.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PetsMenuCommand

      public PetsMenuCommand(org.bukkit.plugin.java.JavaPlugin plugin, PetsManager petsManager)
      Constructs the PetsMenuCommand.
      Parameters:
      plugin - the main plugin instance
      petsManager - 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 interface org.bukkit.command.CommandExecutor
      Parameters:
      sender - the command sender
      command - the command being executed
      label - the label of the command
      args - 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 displayed
      page - the current page number
    • openPetView

      public void openPetView(org.bukkit.entity.Player player, Pet pet, int returnPage)
      Opens the detailed pet view menu for a specific pet.
      Parameters:
      player - the player to whom the menu is displayed
      pet - the pet whose details are displayed
      returnPage - the page to return to when closing the pet view
    • previewPet

      public void previewPet(org.bukkit.entity.Player player, Pet pet)
      Previews a pet by playing a random sound and showing a random quote.
      Parameters:
      player - the player who will see/hear the preview
      pet - the pet to preview