Skip to content

Commit

Permalink
GITBOOK-20: Added LifeStealZ API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
KartoffelChipss authored and gitbook-bot committed Dec 21, 2024
1 parent 937c469 commit 91bc042
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@

* [🏳️ Localization](contributing/localization.md)

## Developer

* [Using the LifeStealZ API](developer/using-the-lifestealz-api.md)
* [API methods](developer/api-methods.md)

***

* [GitHub](https://github.com/KartoffelChipss/LifeStealZ)
* [Modrinth](https://modrinth.com/plugin/lifestealz)
* [SpigotMC](https://www.spigotmc.org/resources/lifestealz.111469/)
* [Support Discord](https://strassburger.org/discord)
* [JavaDoc](https://javadocs.lsz.strassburger.dev)
* [JavaDoc](https://javadocs.lifestealz.com)
13 changes: 13 additions & 0 deletions docs/developer/api-methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
description: This page is about what each API method does
icon: brackets-curly
---

# API methods

You can get a detailed and always up to date list of all API methods [here](https://javadocs.lifestealz.com/org/strassburger/lifestealz/api/LifeStealZAPI.html).

{% embed url="https://javadocs.lifestealz.com/" %}
LifeStealZ JavaDocs
{% endembed %}

107 changes: 107 additions & 0 deletions docs/developer/using-the-lifestealz-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
description: This page is about how to use the LifeStealZ API in your own plugin.
icon: code-simple
---

# Using the LifeStealZ API

### Importing LifeStealZ

Use the below code example matching your dependency manager. Replace the version with [the current one](https://github.com/KartoffelChipss/LifeStealZ/releases/latest).

{% tabs %}
{% tab title="Maven" %}
{% code title="pom.xml" %}
```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>
```
{% endcode %}
{% endtab %}

{% tab title="Gradle" %}
```gradle
repositories {
maven {
url = 'https://maven.pkg.github.com/KartoffelChipss/LifeStealZ'
}
}
dependencies {
compileOnly 'org.strassburger:lifestealz:0.0.0'
}
```
{% endtab %}
{% endtabs %}

### Set LifeStealZ as (soft)depend

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

{% tabs %}
{% tab title="Required dependency" %}
{% code title="plugin.yml" %}
```yaml
name: ExamplePlugin
version: 1.0
author: author
main: your.main.path.Here

depend: ["LifeStealZ"]
```
{% endcode %}
{% endtab %}
{% tab title="Optional dependency" %}
{% code title="plugin.yml" %}
```yaml
name: ExamplePlugin
version: 1.0
author: author
main: your.main.path.Here

softdepend: ["LifeStealZ"]
```
{% endcode %}
{% endtab %}
{% endtabs %}
### Use the API methods
To use the API methods, you'll need to get an implementation of the [LifeStealZAPI Interface](https://javadocs.lifestealz.com/org/strassburger/lifestealz/api/LifeStealZAPI.html):&#x20;
```java
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](api-methods.md).

0 comments on commit 91bc042

Please sign in to comment.