Skip to main content

Adding pineapple to your project

Welcome to PineappleLib, this wiki will explain how to add it and all of its features for you to add to your spigot plugins

Adding the repo

<repositories>
<repository>
<name>Miles Repository</name>
<url>https://maven.miles.sh/libraries</url>
</repository>
</repositories>

Adding the dependency

<dependencies>
<dependency>
<groupId>sh.miles</groupId>
<artifactId>Pineapple</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>

Shading PineappleLib

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>sh.miles.pineapple</pattern>
<shadedPattern>CHANGE.ME.libs.pineapple</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Initializing

PineappleLib requires a plugin instance to function properly, to give it to Pineapple please add the following code to onEnable() or onLoad()

PineappleLib.initialize(this)

While by default PineappleLib requires the use of NMS you can disable it before initialization

PineappleLib.initialize(this, false) // false disables NMS
danger

While disabling NMS is a supported feature not all NMS features have appropriate backups. Avoid NMS tags when disabling NMS