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):
1
public class BlockBreakQuest extends QuestExecutor {
2
3
public BlockBreakQuest(BattlePlugin plugin) {
4
super(plugin);
5
}
6
7
@EventHandler(ignoreCancelled = true)
8
public void onBlockBreak(BlockBreakEvent event) {
9
Player player = event.getPlayer();
10
Block block = event.getBlock();
11
12
super.execute("block-break", player, result -> {
13
return result.root(block);
14
}, replacer -> replacer.set("block", block.getType()));
15
}
16
}
Copied!
4) Now you need to actually register the quest. To do this, you first need to get the quest registry as such:
1
QuestRegistry questRegistry = BattlePlugin.getApi().getQuestRegistry();
Copied!
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:
1
questRegistry.quest(instance -> new BlockBreakQuest(instance));
Copied!
External:
1
questRegistry.hook("pluginname", instance -> new BlockBreakQuest(instance));
Copied!
Last modified 10mo ago
Copy link