Skip to content

InvUI

Configuring Maven / Gradle

Minimum required Java version: 11

To use InvUI, you first have to add the xenondevs maven repository to your build configuration.

<repository>
    <id>xenondevs</id>
    <url>https://repo.xenondevs.xyz/releases</url>
</repository>
maven {
    url 'https://repo.xenondevs.xyz/releases'
}
maven("https://repo.xenondevs.xyz/releases")

Now you can add InvUI as a dependency:

<dependency>
    <groupId>xyz.xenondevs.invui</groupId>
    <artifactId>invui</artifactId>
    <version>VERSION</version>
    <type>pom</type>
</dependency>
implementation "xyz.xenondevs.invui:invui:VERSION"
implementation("xyz.xenondevs.invui:invui:VERSION")
(optional) Manually choosing inventory-access revisions

InvUI uses inventory-access for multi-version support. If you depend on the invui module, you'll automatically get all available inventory-access revisions.
If your plugin does not have multi-version support or you only need certain versions, you can either exclude the related inventory-access revisions or instead depend on the invui-core module which does not have transitive dependencies on any inventory-access revisions.

<dependency>
    <groupId>xyz.xenondevs.invui</groupId>
    <artifactId>invui-core</artifactId>
    <version>VERSION</version>
</dependency>
<dependency>
    <groupId>xyz.xenondevs.invui</groupId>
    <artifactId>inventory-access-r13</artifactId> <!--(1)!-->
    <classifier>remapped-mojang</classifier> <!--(2)!-->
    <version>VERSION</version>
</dependency>
  1. You can find a list of inventory-access revisions and which Minecraft version they map to here.
  2. You can also add the remapped-mojang classifier to get InvUI working on mojang-mapped servers.

If you're using Kotlin, you should also add the invui-kotlin module:

<dependency>
    <groupId>xyz.xenondevs.invui</groupId>
    <artifactId>invui-kotlin</artifactId>
    <version>VERSION</version>
</dependency>
implementation "xyz.xenondevs.invui:invui-kotlin:VERSION"
implementation("xyz.xenondevs.invui:invui-kotlin:VERSION")

To find the latest InvUI version, you can explore the Maven Repository or check out the GitHub Releases Page.

Paper Plugin

Starting with 1.20.5, Paper now ships with a Mojang-mapped runtime by default.
If you're creating a paper plugin, i.e. you have a paper-plugin.yml, you'll need to make sure that InvUI's inventory-access modules are remapped by Paper. (If you don't have a paper-plugin.yml, you can ignore this section.)
This can be achieved by loading InvUI through Paper's library loader:

org.example.MyPluginLoader
public class MyPluginLoader implements PluginLoader {

    @Override
    public void classloader(@NotNull PluginClasspathBuilder pluginClasspathBuilder) {
        MavenLibraryResolver resolver = new MavenLibraryResolver();
        resolver.addRepository(new RemoteRepository.Builder("xenondevs", "default", "https://repo.xenondevs.xyz/releases/").build());
        resolver.addDependency(new Dependency(new DefaultArtifact("xyz.xenondevs.invui:invui:pom:VERSION"), null));
        pluginClasspathBuilder.addLibrary(resolver);
    }

}
paper-plugin.yml
loader: org.example.MyPluginLoader

When InvUI is loaded through the plugin loader, it will not be able to read your plugin instance from the class loader, so you'll need to set it manually in your plugin's onEnable like this:

public class MyPlugin extends JavaPlugin {

    @Override
    public void onEnable() {
        InvUI.getInstance().setPlugin(this);
    }

}

Make sure to not also include InvUI classes in your plugin jar

If you're loading InvUI using the PluginLoader approach above, make sure to not also include InvUI classes in your plugin jar. (i.e. mark the dependency as <scope>provided</scope> in Maven or use the compileOnly dependency configuration in Gradle)

Alternatively, if you want to create a fat jar, you'll need to set the paperweight-mappings-namespace manifest attribute to spigot and make sure that your own classes are remapped accordingly.
For more information, refer to the Paper Documentation.

Mojang-mapped artifacts on the repository

While there are Mojang-mapped artifacts for the inventory-access revisions on the repository, they are not compatible with Paper's Mojang-mapped runtime, as they still use versioned CraftBukkit package names, which are also no longer present in the Paper runtime. They can however be used on Mojang-mapped Spigot servers.

Javadoc

You may also want to check out the InvUI javadoc.