Quests Minecraft Plugin
repository·main·Indexed 42 days ago
https://github.com/pikamug/questsAn open-source questing system for Minecraft servers that allows administrators to create complex questlines and players to complete multiple tasks simultaneously for rewards. Includes administrative tools via /questadmin for managing player progress, quest points, and stages, as well as a developer framework for implementing custom subcommands by extending the BukkitQuestsSubCommand class.
What's inside Quests
- Quests is an open-source Minecraft plugin designed for creating and executing quests on servers. It allows players to engage in multiple simultaneous quests to earn rewards and unlockables.
Download Quests
mainYou can download the Quests plugin from the following vendors:
Translate Quests
mainIf you wish to help localize the plugin or its documentation into your language, you can contribute via Crowdin or GitHub:
- Project Translation: https://crowdin.com/project/translate-quests
- Documentation Translation: https://github.com/PikaMug/QuestsDoc
Compile Quests from source
mainTo compile the project from source, you must have Java 8 and Maven installed on your system. Detailed compilation instructions can be found in the official documentation.Cancel quest listing with BukkitQuestsCommandPreListEvent
mainDevelopers can intercept and cancel the quest listing process by listening for the
BukkitQuestsCommandPreListEvent. This event is fired both when a player requests the first page of quests and when they request a specific page.If the event is cancelled, the quest listing process will stop and no quests will be displayed to the player.
Event Details
- Event Name:
BukkitQuestsCommandPreListEvent - Purpose: Allows plugins to prevent players from viewing the quest list.
- Key Method:
isCancelled()returnstrueif the listing process should be aborted.
- Event Name:
Implement a BukkitQuestsSubCommand
mainTo create a new subcommand for the Quests plugin, extend the
BukkitQuestsSubCommandclass. You must implement several abstract methods to define the command's identity, permissions, and behavior. This class also provides utility methods for common command tasks like player lookup and argument concatenation.Required Abstract Methods
getName(): Returns the command name.getNameI18N(): Returns the localized version of the command name.getDescription(): Returns a description of the command.getPermission(): Returns the permission node required to use the command.getSyntax(): Returns the command usage syntax.getMaxArguments(): Returns the maximum number of arguments allowed.execute(CommandSender commandSender, String[] args): The core logic to run when the command is invoked.
Handle the /quests journal command with BukkitQuestsCommandPreJournalEvent
mainThe
BukkitQuestsCommandPreJournalEventis an event fired immediately before the/quests journalcommand is processed by a player. Developers can listen for this event to intercept the command, perform custom logic, or prevent the command from executing entirely by callingsetCancelled(true).@EventHandler public void onPreJournalCommand(BukkitQuestsCommandPreJournalEvent event) { // Example: Prevent players from seeing their journal if they meet a certain condition if (someCondition) { event.setCancelled(true); } }Handle the /quests list command with BukkitQuestsCommandPreListEvent
mainThe
BukkitQuestsCommandPreListEventis an event fired immediately before the/quests listcommand is processed by a player. Developers can listen to this event to intercept the command, inspect the requested page, or cancel the command entirely by callingsetCancelled(true). This is useful for implementing custom permission checks or restricting access to specific quest pages.@EventHandler public void onQuestsList(BukkitQuestsCommandPreListEvent event) { // Check which page the player is trying to view int requestedPage = event.getPage(); // Example: Cancel the command if they try to access a page higher than 5 if (requestedPage > 5) { event.setCancelled(true); } }Intercept the /quests editor command with BukkitQuestsCommandPreEditorEvent
mainThe
BukkitQuestsCommandPreEditorEventis an event fired in the Bukkit environment immediately before a player executes the/quests editorcommand.By listening for this event, you can intercept the command attempt and cancel it using
setCancelled(true). This is useful for implementing custom permission checks, cooldowns, or restricting access to the quest editor based on specific server conditions that go beyond standard permission nodes.@EventHandler public void onPreEditor(BukkitQuestsCommandPreEditorEvent event) { // Example: Cancel the command if the player is in a specific world if (event.getPlayer().getWorld().getName().equals("restricted_world")) { event.setCancelled(true); } }Use BukkitQuestsSubCommand utility methods
mainThe
BukkitQuestsSubCommandclass provides static helper methods to simplify common command implementation tasks:- Player Lookup:
getOnlinePlayer(String name): Finds an online player. It supports partial matches (case-insensitive) usingstartsWithorcontainslogic.getOfflinePlayer(String name): Finds a player, checking online players first, then searching through offline player data. Also supports partial matches.
- Validation:
assertNonPlayer(CommandSender commandSender): Checks if the sender is NOT aPlayer(e.g., the Console). If the sender is the console, it sends aconsoleErrormessage and returnstrueto indicate the assertion failed.
- Argument Handling:
concatArgArray(String[] args, int startingIndex, int endingIndex, char delimiter): Combines multiple command arguments into a single string. This is useful for commands where a name or value might contain spaces (e.g., a quest name).
- Data Manipulation:
sort(Map<String, Integer> unsortedMap): Returns a newLinkedHashMapcontaining the entries of the provided map, sorted by value in descending order.
- Player Lookup:
Handle BukkitQuestsCommandEvent
mainThe
BukkitQuestsCommandEventis an abstract event fired when a Quests-related command is executed within a Bukkit environment. Developers can listen to this event to intercept or react to command executions. You can retrieve theBukkitQuesterinvolved in the command viagetQuester()to access player-specific quest data and actions.@EventHandler public void onQuestsCommand(BukkitQuestsCommandEvent event) { BukkitQuester quester = event.getQuester(); // Handle the command execution logic here }Permissions for /questadmin setstage
mainTo use the
/questadmin setstagecommand, a user must possess one of the following permissions:quests.admin.setstage(Specific permission for setting stages)quests.admin.*(Wildcard permission for all quest admin commands)