Skip to content

ReloadEvent Support

Noah edited this page Aug 24, 2024 · 6 revisions

Step 1: Adding the Maven/Gradle Dependency

Using Maven

Inside of your Maven repositories add the following:

	<repository>
	    <id>jitpack.io</id>
	    <url>https://jitpack.io</url>
	</repository>

Then, inside of your Maven dependencies add the following:

	<dependency>
	    <groupId>com.github.amnoah.betterreload</groupId>
	    <artifactId>api</artifactId>
	    <version>v1.0.0</version>
	    <scope>provided</scope>
	</dependency>

Using Gradle

Inside of your Gradle repositories add the following:

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

Then, inside of your Gradle dependencies add the following:

	implementation 'com.github.amnoah.betterreload:api:v1.0.0'

Step 2: Add to Plugin.yml

Dependency

If your plugin relies on BetterReload being present, you should add BetterReload to your depend node.

Example:

depend:
  - BetterReload

Soft-Dependency

If you are only relying on BetterReload if it is present, you should add BetterReload to your softdepend note.

Example:

softdepend:
  - BetterReload

Step 3: Use the ReloadEvent

If you are soft-depending, I'd recommend making sure that BetterReload is present before registering any listeners. This can be done like this:

if (Bukkit.getPluginManager().getPlugin("BetterReload") != null)
    // Register listener.
}

Now you can use the ReloadEvent like you would any other Bukkit event!

To learn how to use Bukkit events, please check the SpigotMC Event API wiki.

Clone this wiki locally