Using the LifeStealZ API

This page is about how to use the LifeStealZ API in your own plugin.

Importing LifeStealZ

Use the below code example matching your dependency manager. Replace the version with the current one.

pom.xml
<repositories>
    <repository>
        <id>github</id>
        <url>https://maven.pkg.github.com/KartoffelChipss/LifeStealZ</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>org.strassburger</groupId>
        <artifactId>lifestealz</artifactId>
        <version>0.0.0</version>
    </dependency>
</dependencies>

Set LifeStealZ as (soft)depend

In the next step, you will have to go to your plugin.ymlfile and add LifeStealZ as a dependency.

plugin.yml
name: ExamplePlugin
version: 1.0
author: author
main: your.main.path.Here

depend: ["LifeStealZ"]

Use the API methods

To use the API methods, you'll need to get an implementation of the LifeStealZAPI Interface:

package org.strassburger.testPluginMaven;

import org.bukkit.plugin.java.JavaPlugin;
import org.strassburger.lifestealz.LifeStealZ;
import org.strassburger.lifestealz.api.LifeStealZAPI;

public final class TestPluginMaven extends JavaPlugin {

    @Override
    public void onEnable() {
        LifeStealZAPI lifeStealZAPI = LifeStealZ.getAPI();

        getLogger().info("TestPluginMaven enabled");
    }

    @Override
    public void onDisable() {
        getLogger().info("TestPluginMaven disabled");
    }
}

Read more about the API methods here.

Last updated