-
-
Notifications
You must be signed in to change notification settings - Fork 27
Installation
You'll need approximately two minutes to integrate the QuartzLib inside your plugin, if you are using Maven already.
Currently, QuartzLib requires Java 8 or later, Bukkit 1.15 or later. This document explains how to install QuartzLib 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-quartzlib</id> <url>https://maven.zcraft.fr/QuartzLib</url> </repository>
-
Add QuartzLib as a dependency.
<dependency> <groupId>fr.zcraft</groupId> <artifactId>quartzlib</artifactId> <version>0.0.1-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.4</version> <configuration> <artifactSet> <includes> <include>fr.zcraft:quartzlib</include> </includes> </artifactSet> <relocations> <relocation> <pattern>fr.zcraft.quartzlib</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 QuartzLib provides his own version of the JavaPlugin
main class, to semi-automatically load and unload the QuartzLib components and core.
-
In your main class, replace
extends JavaPlugin
withextends QuartzPlugin
(infr.zcraft.quartzlib.core.QuartzPlugin
).import fr.zcraft.quartzlib.core.QuartzPlugin; public class Toaster extends QuartzPlugin { // ... }
-
Use inside
onEnable()
theloadComponents
method to load the components you will use.@Override public void onEnable() { loadComponents(Gui.class, Commands.class, SidebarScoreboard.class); }
The loadComponents
method is the standard way to load the classes (components) used in your plugin. It's a generic tool to load QuartzLib components (GUIs, sidebars...), but also your owns.
In QuartzLib components wiki pages, the component class to load through this method will always be given.
The QuartzLib overrides the onLoad
method.
If your plugin uses it you have to call super.onLoad()
like this.
@Override
public void onLoad()
{
super.onLoad();
// Your code, placed after.
}
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