Creating Your Own Quest Types
With BattlePass v3, creating your own quest types is quick and simple but there are still a few steps.
1) Make sure you depend on BattlePass (or soft depend). If you're soft depending, remember to check if the plugin is enabled.
2) Make a class for your quest and have it extend QuestExecutor. Use your IDE to automatically implement the required constructor.
3) Do whatever you wish and use the execute method to actually trigger the event with all the values with wish.
Use this example to explain the rest (most should be explained just by viewing available inputs anyway):
public class BlockBreakQuest extends QuestExecutor {
public BlockBreakQuest(BattlePlugin plugin) {
@EventHandler(ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
super.execute("block-break", player, result -> {
return result.root(block);
}, replacer -> replacer.set("block", block.getType()));
4) Now you need to actually register the quest. To do this, you first need to get the quest registry as such:
QuestRegistry questRegistry = BattlePlugin.getApi().getQuestRegistry();
5) Now, you can use the registerQuests method to register the quest. If it depends on an external plugin, use the registerHook method (checks if the plugin is enabled).
Internal: -> new BlockBreakQuest(instance));
questRegistry.hook("pluginname", instance -> new BlockBreakQuest(instance));
Copy link