-
-
Notifications
You must be signed in to change notification settings - Fork 25
Installation
You'll need approximately two minutes to integrate the zLibrary inside your plugin, if you are using Maven already.
Currently, the zLib requires Java 7 or later, Bukkit 1.8.3 or later. This document explains how to install the zLib if you are using Maven, but it works too with other system, as long as a shading-like feature is present.
-
Add our Maven repository to your
pom.xml
file.<repository> <id>zDevelopers</id> <url>http://maven.carrade.eu/artifactory/snapshots</url> </repository>
-
Add the zLib as a dependency.
<dependency> <groupId>fr.zcraft</groupId> <artifactId>zlib</artifactId> <version>0.99-SNAPSHOT</version> </dependency>
-
Add the shading plugin to the build. Replace
YOUR.OWN.PACKAGE
with your own package.<build> ... <plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.3</version> <configuration> <artifactSet> <includes> <include>fr.zcraft:zlib</include> </includes> </artifactSet> <relocations> <relocation> <pattern>fr.zcraft.zlib</pattern> <shadedPattern>YOUR.OWN.PACKAGE</shadedPattern> </relocation> </relocations> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin> ... </plugins> ... </build>
-
Build your project as usual, as example with the following command from your working directory, or using an integrated tool from your IDE.
mvn clean install
Currently, there is only one simple way to integrate this library. The zLib provides his own version of the JavaPlugn
main class, to semi-automatically load and unload the zLib components and core.
-
in your main class, replace
extends JavaPlugin
withextends ZPlugin
(infr.zcraft.zlib.core.ZPlugin
); -
use inside
onEnable()
theloadComponents
method to load the components you will use. Example:@Override public void onEnable() { loadComponents(Gui.class, Commands.class, SidebarScoreboard.class); }
A note about overriden methods
The zLibrary overrides the onLoad
and onDisable
methods. If your plugin use them, you have to call super.onLoad()
at the beginning of onLoad
, and super.onDisable()
at the end of onDisable()
.
Getting started
Components
Tools
Pour démarrer
Composants
- Commandes
- Configuration
- Internationalisation
- GUIs
- Barres latérales
- Services de travail en arrière plan
- NBT
-
Composants personnalisés
Outils