-
Notifications
You must be signed in to change notification settings - Fork 0
Developer API
You can find an overview of the general methods here, with this link you can get an overview of the whole api.
To access the interfaces in the links above, do the following.
Step 1:
Add the following to your plugin.yml
.
depend: [LuxuryQuests]
Step 2:
Api api = QuestsPlugin.getApi();
Step 3: You can now use all the methods in the interface.
When creating a quest, your class must extend the QuestExecutor
class.
Thereafter you need an event or more to trigger the QuestExecutor#execute
method.
Example:
public class BlockBreakQuest extends QuestExecutor {
public BlockBreakQuest(QuestsPlugin plugin) {
super(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()));
}
}
You will now need to register the quest, as follows.
Step 1:
QuestRegistry questRegistry = QuestsPlugin.getApi().getQuestRegistry();
Step 2:
If the event or events in your quest executor comes with spigot do this
questRegistry.registerQuests(instance -> new BlockBreakQuest(instance));
If the event or events come from a third party plugin do this
questRegistry.registerHook("pluginname", instance -> new BlockBreakQuest(instance));
If you are using a third party plugin, remember to add depend: [pluginname]
to your plugin.yml
.
Step 3:
All done! Enjoy your new quest and contact us through discord for further help.