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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.bukkit.entity.Player
getTargetPlayer
(org.bukkit.command.CommandSender sender, String playerName) Retrieves a player instance by their exact name.protected int
parseQuestIndex
(org.bukkit.command.CommandSender sender, String arg) Parses an integer value from a string argument.Methods inherited from class com.ordwen.odailyquests.api.commands.admin.AdminMessages
help, invalidAmount, invalidCategory, invalidPlayer, invalidQuest
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ordwen.odailyquests.api.commands.admin.AdminCommand
execute, getName, getPermission
Methods inherited from interface com.ordwen.odailyquests.api.commands.admin.AdminCommandCompleter
onTabComplete
-
Field Details
-
TOTAL
- See Also:
-
QUESTS
- See Also:
-
AMOUNT
- See Also:
-
TARGET
- See Also:
-
CATEGORY
- See Also:
-
-
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, ornull
otherwise
-
parseQuestIndex
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
-