Class SetCommand
java.lang.Object
com.ordwen.odailyquests.api.commands.admin.AdminMessages
com.ordwen.odailyquests.api.commands.admin.AdminCommandBase
com.ordwen.odailyquests.commands.admin.handlers.SetCommand
- All Implemented Interfaces:
AdminCommand
,AdminCommandCompleter
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)
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
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Executes the admin command.getName()
Gets the name of the command.Gets the required permission to execute the command.onTabComplete
(org.bukkit.command.CommandSender sender, String[] args) Provides tab-completion for the /dqa set command.Methods inherited from class com.ordwen.odailyquests.api.commands.admin.AdminCommandBase
getTargetPlayer, parseQuestIndex
Methods inherited from class com.ordwen.odailyquests.api.commands.admin.AdminMessages
help, invalidAmount, invalidCategory, invalidPlayer, invalidQuest, invalidQuestId
-
Constructor Details
-
SetCommand
public SetCommand()
-
-
Method Details
-
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
Description copied from interface:AdminCommand
Gets the required permission to execute the command.- Returns:
- the permission node required to execute this command
-
execute
Executes the admin command.Steps:
- Validate arguments count (requires 5)
- Resolve target player and load its
PlayerQuests
- Check slot index bounds
- Check that category and quest ID exist
- Attempt quest replacement and handle
PlayerQuests.ReplaceResult
- Send feedback messages to sender and target
- Parameters:
sender
- the executor (admin)args
- command arguments
-
onTabComplete
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
-