From 0aac85ff5c27e98564243a9f43ae58685bd18ff2 Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Thu, 6 Jul 2023 14:10:24 +0100 Subject: Migrate docs to GitHub pages --- docs/developer/api.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/developer/api.md (limited to 'docs/developer/api.md') diff --git a/docs/developer/api.md b/docs/developer/api.md new file mode 100644 index 00000000..4ab49017 --- /dev/null +++ b/docs/developer/api.md @@ -0,0 +1,34 @@ +--- +title: API +parent: Developer +--- + +# API + +{% include incomplete.md %} + +Quests provides an API for other people to use. **This API is experimental and may be subject to change.** For usages, it is best to take a look into the plugin itself. + +## Bukkit +You can get an instance of Quests as you would with any other plugin: +```java +BukkitQuestsPlugin questsPlugin = (BukkitQuestsPlugin) Bukkit.getPluginManager().getPlugin("Quests"); +``` +From there, you can access the `QPlayerManager`, `QuestManager` etc. See the javadoc in [this file](https://github.com/LMBishop/Quests/blob/master/common/src/main/java/com/leonardobishop/quests/common/plugin/Quests.java), and in each class for more info on its purpose. + +### Events +Quests provides some Bukkit events, you can see them all [here](https://github.com/LMBishop/Quests/tree/master/bukkit/src/main/java/com/leonardobishop/quests/bukkit/api/event). + +### Registering task types +Task types **must** be registered during startup, after Quests has initialized its task type manager. You cannot register task types after this period as individual quests are registered to their task types for performance reasons. + +```java +@Override +public void onEnable() { + // ... + Quests questsPlugin = (Quests) Bukkit.getPluginManager().getPlugin("Quests"); + BukkitTaskTypeManager taskTypeManager = (BukkitTaskTypeManager) questsPlugin.getTaskTypeManager(); + + taskTypeManager.registerTaskType(new ...); +} +``` \ No newline at end of file -- cgit v1.2.3-70-g09d2