# alumina

{% hint style="warning" %}
This wiki is currently in development and may not have all up-to-date documentation.
{% endhint %}

## Useful Resources

JavaDocs: <https://jd.alumina.dev/>

## Adding alumina

<details>

<summary>Maven</summary>

**Repository**

```xml
<repository>
    <id>Negative Games</id>
    <url>https://repo.negative.games/repository/maven-releases/</url>
</repository>
```

**Dependency**

```xml
<dependency>
    <groupId>games.negative.alumina</groupId>
    <artifactId>alumina</artifactId>
    <version>VERSION</version>
    <scope>compile</scope>
</dependency>
```

**Shading**

While optional, it is highly recommended to shade alumina to match your project's namespace; when multiple plugins use alumina on a server, it may produce some unexpected outcomes.

```xml
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.5.0</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <createDependencyReducedPom>false</createDependencyReducedPom>
                <relocations>
                    <relocation>
                        <pattern>games.negative.alumina</pattern>
                        <shadedPattern>[YOUR NAMESPACE].alumina</shadedPattern>
                    </relocation>
                </relocations>
            </configuration>
        </execution>
    </executions>
</plugin>
```

</details>

<details>

<summary>Gradle</summary>

**Repository**

```gradle
maven { url 'https://repo.negative.games/repository/maven-releases/' }
```

**Dependency**

```gradle
implementation("games.negative.alumina:alumina:VERSION")
```

**Shading**

While optional, it is highly recommended to shade alumina to match your project's namespace; when multiple plugins use alumina on a server, it may produce some unexpected outcomes.

**`Shadow Plugin`**

The shadow-jar plugin is required to shade alumina into your project.

```gradle
plugins {
    id 'java'
    id "com.github.johnrengelman.shadow" version "7.1.2"
}
```

**`Build-Task-Dependency`**

While it is optional to have this because you can do <mark style="color:green;">`gradle shadowJar`</mark>, it is recommended to add the following declaration so your <mark style="color:green;">`gradle build`</mark> will automatically shade alumina.

```gradle
tasks {
    build {
        dependsOn(shadowJar)
    }
}
```

**`ShadowJar Task`**

This is the bread & butter of the shading process, and this declaration is required to shade alumina in your project.

<pre class="language-gradle"><code class="lang-gradle">def group = 'com.myplugin.plugin' // Not required
def id = 'MyAmazingPlugin' // Not required
<strong>
</strong><strong>shadowJar {
</strong>    archiveBaseName.set("${id}")
    archiveClassifier.set("")
    archiveVersion.set("")

    relocate("games.negative.alumina", "${group}.libs.alumina")
}
</code></pre>

</details>

## Adding <mark style="color:blue;">`AluminaPlugin`</mark>

The <mark style="color:green;">`AluminaPlugin`</mark> class, which extends <mark style="color:green;">`JavaPlugin`</mark>, is a required class for alumina to function, as the library does some logic behind the scenes when the plugin starts.

When being used, the <mark style="color:green;">`AluminaPlugin`</mark> class has three abstract methods that are required to be implemented, which is [<mark style="color:purple;">`load()`</mark>](#user-content-fn-1)[^1], [<mark style="color:purple;">`enable()`</mark>](#user-content-fn-2)[^2], and [<mark style="color:purple;">`disable()`</mark>](#user-content-fn-3)[^3].

<details>

<summary>Example Class</summary>

```java
public class ExamplePlugin extends AluminaPlugin {
    
    @Override
    public void load() {
        
    }

    @Override
    public void enable() {
        // Register listeners, commands, etc.
    }

    @Override
    public void disable() {

    }
    
}
```

</details>

[^1]: This method takes over for the <mark style="color:green;">`JavaPlugin`</mark>'s <mark style="color:purple;">`onLoad()`</mark> method.

[^2]: This method takes over for the <mark style="color:green;">`JavaPlugin`</mark>'s <mark style="color:purple;">`onEnable()`</mark> method.

[^3]: This method takes over for the <mark style="color:green;">`JavaPlugin`</mark>'s <mark style="color:purple;">`onDisable()`</mark> method.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.ericlmao.com/projects/alumina.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
