Skip to content

API Usage

Alessio Gravili edited this page Jan 1, 2022 · 25 revisions

Adding the API to your project

For Gradle Kotlin DSL (recommended): Add this to your build.gradle.kts:

	maven {
        url = "https://maven.pkg.github.com/alessiogr/NotQuests"
        content{
            includeGroup("rocks.gravili.notquests")
        }
        credentials {
            username = System.getenv("GITHUB_PACKAGES_USERID") ?: "alessiogr"
            password = System.getenv("GITHUB_PACKAGES_IMPORT_TOKEN") ?: "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"
        }
    }

	dependencies {
	    compileOnly 'rocks.gravili.notquests:paper:3.2.5'
	}

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 replaced 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