Class AdminCommandBase

java.lang.Object
com.ordwen.odailyquests.api.commands.admin.AdminMessages
com.ordwen.odailyquests.api.commands.admin.AdminCommandBase
All Implemented Interfaces:
AdminCommand, AdminCommandCompleter
Direct Known Subclasses:
AddCommand, ARerollCommand, AShowCommand, CompleteCommand, ConvertCommand, CustomCompleteCommand, OpenCommand, RemoveCommand, ResetCommand

public abstract class AdminCommandBase extends AdminMessages implements AdminCommand, AdminCommandCompleter
This is an abstract base class for admin commands in the O'DailyQuests plugin. It provides common functionality for retrieving players and parsing quest indices, which can be used by any specific admin command that extends this class.

This class implements the AdminCommand and AdminCommandCompleter interfaces, enabling it to handle both the command execution and tab-completion features.

  • Field Details

  • Constructor Details

    • AdminCommandBase

      public AdminCommandBase()
  • Method Details

    • getTargetPlayer

      protected org.bukkit.entity.Player getTargetPlayer(org.bukkit.command.CommandSender sender, String playerName)
      Retrieves a player instance by their exact name.

      If the player is not found (offline or name mismatch), sends an "invalid player" message to the sender and returns null.

      Parameters:
      sender - the command sender (used to send feedback in case of an invalid player)
      playerName - the exact name of the target player
      Returns:
      the target Player if found, or null otherwise
    • parseQuestIndex

      protected int parseQuestIndex(org.bukkit.command.CommandSender sender, String arg)
      Parses an integer value from a string argument.

      If the argument is not a valid number, sends an "invalid quest index" message to the sender and returns -1 as a fallback.

      Parameters:
      sender - the command sender (used to send feedback in case of invalid input)
      arg - the string to parse as an integer
      Returns:
      the parsed integer value, or -1 if the input was invalid