Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Developer API

Zak Shearman edited this page Jul 14, 2020 · 1 revision

General Methods

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.


Creating a Quest

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.