Skip to content
Elikill58 edited this page Dec 8, 2022 · 3 revisions

General

Negativity has an API. You can check javadoc here (old = v1.10 or older).

There is 2 major versions of API :

But, there is common API for both major version.

Permission

You can check if the player have a permission thanks to Perm.hasPerm(entity, perm).

To use your specific permission checker, you have to use Perm.registerChecker(checkerId, checker). Then, set your checker ID to "Permissions.checker" in config.

Banishment

To edit the current ban processor, you have to use BanManager.registerProcessor(id, processor), then set the ID to ban.processor.

You can manage ban thanks to BanManager. It automatically get information about ban processor currently used. You can get logged or active ban and edit ban like execute or revoke ban.

To check if the player should be banned, you can use BanUtils.shouldBan(cheat, np, reliability).

Translated messages

To use your own translation system, you have to use TranslatedMessages.registerTranslationProviderFactory(id, factory).

Then, edit Translation.provider in config, set your own factory ID. Now, it will works !

API for V1 (1.X.X - free)

There is no easy way to include it in your classpath with maven/gradle thing. You should do it yourself.

At the beginnning, like they wasn't any API, I just create some events to enable other people to manage Negativity's action.

So, now there is events and NegativityPlayer which enable you to get and edit Negativity data.

The API is according to the platform. For example, you have to call the good NegativityPlayer like SpigotNP or SpongeNP.

You can also use Universal options.

API for V2 (2.X.X - premium)

To add the plugin to your classpath, you can use jitpack:

Gradle

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

dependencies {
    compileOnly 'com.github.Elikill58:Negativity:v2-SNAPSHOT'
}

Maven

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

<dependencies>
   <dependency>
      <groupId>com.github.Elikill58</groupId>
      <artifactId>Negativity</artifactId>
      <version>v2-SNAPSHOT</version>
      <scope>provided</scope>
   </dependency>
</dependencies>

V2 have a big internal change :

Platform as Spigot and Sponge, just call the Negativity API.

Me, I made all detection on my own API.

This custom API use own events, entity, player ...

So, there is interface for everything.

For example, you have the event PlayerMoveEvent, which have location and player, which available for both platform. This allow me to edit a common section which automatically edit both platform.

Clone this wiki locally