Skip to main content
Version: 2.1.0

Installation

MavenRepo JavaDocs

Repository

<repository>
<id>JodexIndustries</id>
<name>JodexIndustries Repo</name>
<url>https://repo.jodex.xyz/releases</url>
</repository>

Installation and Usage

Snippets are available for Maven, Gradle Groovy, and Gradle Kotlin DSL.

There are two ways to use the library depending on your project structure:

1. Using as a standalone plugin (api module)

  • JGuiWrapper is installed as a separate plugin on the server.
  • Your plugin simply connects to its API without shading.
<dependency>
<groupId>com.jodexindustries.jguiwrapper</groupId>
<artifactId>api</artifactId>
<version>loading</version>
<scope>provided</scope>
</dependency>

2. Embedding into your project (common module)

  • You directly include the library and shade it into the final jar using shade (or shadowJar).
  • No need to install JGuiWrapper as a separate plugin.
<dependency>
<groupId>com.jodexindustries.jguiwrapper</groupId>
<artifactId>common</artifactId>
<version>loading</version>
<scope>compile</scope>
</dependency>

If you want to include nms logic for title management

<dependency>
<groupId>com.jodexindustries.jguiwrapper</groupId>
<artifactId>nms</artifactId>
<version>loading</version>
<scope>compile</scope>
</dependency>

General Initialization

warning

Using the library without the standalone JGuiWrapper plugin requires you to initialize the listeners in your main plugin class.

@Override
public void onEnable() {
JGuiInitializer.init(this); // registers all listeners
}

After calling init, you can create and open GUIs for any player.


API

Publicly available API methods can be found in the GuiApi class, which is the parent class of JGuiInitializer.

GuiApi api = GuiApi.get();
warning

It should be noted that GuiApi#get() may throw an initialization error, as JGuiInitializer#init(Plugin) was not called, which means that the API was not initialized.

Secure access to the API

Sometimes it happens that initialization can be called later than certain logic with interaction with GuiApi, so it is worth using GuiApi#getOptional()

GuiApi.getOptional().ifPresent(api -> {
Plugin plugin = api.getPlugin();
});