Skip to content

API Usage

Alessio Gravili edited this page Dec 26, 2021 · 25 revisions

Adding the API to your project

There's a nice tutorial here: https://jitpack.io/#AlessioGr/NotQuests/-SNAPSHOT

Example: Add this to your build.gradle:

	allprojects {
		repositories {
			maven { url 'https://jitpack.io' }
		}
	}

	dependencies {
	        implementation 'com.github.AlessioGr:NotQuests:VERSION'
	}

Replace VERSION with the version you want to use. For example v3.1.0

If Jitpack doesn't work, simply add the plugin jar manually to your project.

Paper and Spigot modules

After installing the API, you will notice that we basically have two almost-identical modules: Paper and Spigot. Please, only use the Paper module. The Spigot module only exists to comply with spigot.org resource guidelines and will be removed once spigot.org is dead and has been replace with Hangar.

I will not provide feature updates for the Spigot module anymore. Please use the paper module.

Why?

The Spigot API is old and uses a lot of long-abandoned, legacy features. NotQuests however is a modern plugin and uses modern API features, which Spigot does not have and refuses to add. (Most importantly Kyori components, or even stupidly simple stuff like Bukkit.getTPS())

Using the API

First, add NotQuests as depend: or softdepend: into you plugin.yml.

Then, access the instance with NotQuests.getInstance() (use the NotQuests of the paper module) and do whatever you want with it 😄

Make sure to disable your NotQuests integration, if NotQuests.getInstance() is null. Since you are hopefully use the Paper module, it would return null on Spigot servers.

Registering your own Objectives

You can easily add your own Objectives to NotQuests (either directly or via the API) with, for example, NotQuests.getInstance().getObjectiveManager().registerObjective("jumpobjective", JumpObjective.class);

with JumpObjective extending "Objective" and being similar to all the other objective classes. Just copy the structure.

Only thing which is missing are commands & command completions. At the moment, they would manually need to be added to "ObjectivesAdminCommand".

Clone this wiki locally