All Implemented Interfaces:
AdminCommand, AdminCommandCompleter

public class SetCommand extends AdminCommandBase
Administrative command allowing an admin to set a specific quest in a given slot for a target player.

Usage:

/dqa set <player> <slot> <category> <quest_id>
  • player: target player name
  • slot: quest slot index (1-based)
  • category: category name (must exist in CategoriesLoader)
  • quest_id: quest file index (unique ID within the category)
This command uses PlayerQuests.setQuestAtIndex(int, AbstractQuest) to replace an existing quest by another one, while respecting the rules:
  • Prevents duplicates if the quest is already present
  • Rejects invalid indices or unknown categories/quests
  • Notifies both the command sender and the target player
  • Constructor Details

    • SetCommand

      public SetCommand()
  • Method Details

    • getName

      public String getName()
      Description copied from interface: AdminCommand
      Gets the name of the command. This is used as the subcommand identifier (e.g., /command <name>).
      Returns:
      the main command literal, i.e. "set"
    • getPermission

      public String getPermission()
      Description copied from interface: AdminCommand
      Gets the required permission to execute the command.
      Returns:
      the permission node required to execute this command
    • execute

      public void execute(org.bukkit.command.CommandSender sender, String[] args)
      Executes the admin command.

      Steps:

      1. Validate arguments count (requires 5)
      2. Resolve target player and load its PlayerQuests
      3. Check slot index bounds
      4. Check that category and quest ID exist
      5. Attempt quest replacement and handle PlayerQuests.ReplaceResult
      6. Send feedback messages to sender and target
      Parameters:
      sender - the executor (admin)
      args - command arguments
    • onTabComplete

      public List<String> onTabComplete(@NotNull org.bukkit.command.CommandSender sender, String[] args)
      Provides tab-completion for the /dqa set command.
      • Arg 2: list of online player names
      • Arg 3: slot numbers available for the target player
      • Arg 4: category names
      • Arg 5: quest IDs from the chosen category
      Parameters:
      sender - the command sender (can be a player or the console)
      args - the arguments currently entered for the command
      Returns:
      a list of possible completions, null to let Bukkit suggest player names, or an empty list to disable suggestions