This framework works for Minecraft versions 1.14-1.18
An inventory framework for managing GUIs
This framework is based on a pane principle. This means that the GUI is divided into different types of panes which all behave differently. A GUI consists of multiple panes which can interact with each other.
Next to those panes, GUIs can also be created from XML files by simple loading them in. This allows for easy GUI creation with little code.
To add this project as a dependency to your pom.xml, add the following to your pom.xml:
<dependency>
<groupId>com.github.stefvanschie.inventoryframework</groupId>
<artifactId>IF</artifactId>
<version>0.10.4</version>
</dependency>
The project is in the Central Repository, so specifying a repository is not needed.
Now in order to shade the project into your project, add the following to your pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<relocations>
<relocation>
<pattern>com.github.stefvanschie.inventoryframework</pattern>
<shadedPattern>[YOUR PACKAGE].inventoryframework</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
Replace [YOUR PACKAGE] with the top-level package of your project.
To add this project as a dependency for your Gradle project, make sure your dependencies
section of your build.gradle looks like the following:
dependencies {
compile 'com.github.stefvanschie.inventoryframework:IF:0.10.4'
// ...
}
The project is in Maven Central, so ensure your repositories
section resembles the following:
repositories {
mavenCentral()
// ...
}
In order to include the project in your own project, you will need to use the shadowJar
plugin. If you don't have it already, add the following to the top of your file:
apply plugin: 'com.github.johnrengelman.shadow'
To relocate the project's classes to your own namespace, add the following, with [YOUR PACKAGE] being the top-level package of your project:
shadowJar {
relocate 'com.github.stefvanschie.inventoryframework', '[YOUR PACKAGE].inventoryframework'
}
You can also specify your dependency directly in your plugin.yml. Please note that this downloads the dependency on the server, which means that you can only use the plugin on a server with an internet connection.
libraries:
- com.github.stefvanschie.inventoryframework:IF:0.10.4
If you want to build this project from source, run the following from Git Bash:
git clone https://github.com/stefvanschie/IF.git
cd IF
mvn clean package
The build can then be found in /IF/target/.
IF supports Adventure, but does not shade it in itself.
The use of Adventure Component
s instead of legacy String
s is completely optional.
If you do not wish to use Adventure you can safely ignore all TextHolder
related methods.
Adventure is a library that adds proper modern text support to Minecraft.
Modern text is represented using bungee-chat and BaseComponent
instances in Spigot.
Adventure is an alternative to bungee-chat and offers more features.
You don't need to import/shade anything for Adventure support in this case!
Note: Paper only supports Adventure on build 473 and above. If you aren't running months old builds, then you are fine.
On Spigot Adventure isn't included in the server, therefore you have to shade and relocate it yourself. The following dependencies need to be imported and shaded:
- adventure-api
- adventure-platform-bukkit
Please consult the Adventure documentation for more information.
Example of migration from legacy String
to Adventure Component
:
- legacy:
namedGui.setTitle("My Title!");
- Adventure:
namedGui.setTitle(ComponentHolder.of(Component.text("My Title!")));
We apologize for the boilerplate (the ComponentHolder.of(...)
call), but that was the only way to not make IF hard-depend on Adventure.
Full Adventure support is only achieved when your server natively supports Adventure (it is running Paper) and your plugin depends on Paper (instead of Spigot).
In other words, you won't benefit from Adventure as much if you use Spigot instead of Paper.
This is because when Adventure is relocated we have to convert everything back to legacy String
s before passing them to the Bukkit API.