Skip to content

Repository files navigation

Knockback API

A simple API to allow plugins to apply different knockback profiles to players.

Supported Spigots

Please note that these spigots are supported through public APIs.

  • ImanitySpigot
  • AzuriteSpigot
  • FoxSpigot

Installation

Gradle

repositories {
maven {
name ="refine-public"
url = uri("https://maven.refinedev.xyz/public-repo/")
}
}
dependencies {
implementation("xyz.refinedev.api:KnockbackAPI:1.0.0")
}

Maven

<repositories>
<repository>
<id>refine-public</id>
<url>https://maven.refinedev.xyz/public-repo/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>xyz.refinedev.api</groupId>
<artifactId>KnockbackAPI</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

Usage

Basic Setup

importxyz.refinedev.api.knockback.knockbackHandler;
publicclassExamplePluginextendsJavaPluginimplementsListener {
privateKnockbackHandlerknockbackHandler;
@OverridepublicvoidonEnable() {
this.knockbackHandler = newKnockbackHandler();
//this.knockbackHandler.registerHook(new CustomHook()); Register your own hook before init call.this.knockbackHandler.init();
getServer().getPluginManager().registerEvents(this, this);
}
@OverridepublicvoidonDisable() {
// Plugin shutdown logic
}
@EventHandler(priority = EventPriority.HIGHEST)
publicvoidonJoin(PlayerJoinEventevent) {
Playerplayer = event.getPlayer();
KnockbackHookhook = knockbackHandler.getHook();
hook.setKnockback(player, "test");
}
}

Registering Custom Hooks

You can implement hooks for your own spigot forks by implementing the 'KnockbackHook' interface and registering it before the init call.

importxyz.refinedev.api.knockback.KnockbackHook;
publicclassCustomHookimplementsKnockbackHook {
// Implement required methods
}
knockbackHandler.registerHook(newCustomHook());
// or force it as the active hook after the init callknockbackHandler.setHook(newCustomHook());

Contributing

Pull requests and suggestions are welcome! Please open an issue or PR for any improvements.

License

This project is open source and may be used in commercial or non-commercial projects, provided that credit is given to the authors of this repository. Selling the code itself is not permitted.

About

A simple API to allow plugins to apply different knockback profiles to players.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages