Developer API Starter - Multiverse/Multiverse-Core GitHub Wiki

This document outlines the basics of how plugin developers can read and modify Multiverse data to enhance world management on their server.

Adding Multiverse-Core to your project

All Multiverse modules are hosted on our very own nexus repository.

Replace the [MODULE] placeholders with the various Multiverse modules:

  • Core
  • Inventories
  • Portals
  • NetherPortals
  • SignPortals

As for the version, use the latest release version based on their respective Bukkit site.

Maven

<repositories>
    <repository>
        <id>OnARandomBox</id>
        <url>https://repo.onarandombox.com/content/groups/public/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.onarandombox.multiverse[MODULE]</groupId> <!-- Don't forget to replace this -->
        <artifactId>Multiverse-[MODULE]</artifactId> <!-- Replace this as well -->
        <version>[VERSION]</version> <!-- This too -->
        <scope>provided</scope>
    </dependency>
</dependencies>

Example

<dependencies>
    <dependency>
        <groupId>com.onarandombox.multiversecore</groupId>
        <artifactId>Multiverse-Core</artifactId>
        <version>4.3.1</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Gradle

repositories {
    maven { url = "https://repo.onarandombox.com/content/groups/public/" }
}

dependencies {
    compileOnly 'com.onarandombox.multiverse[MODULE]:Multiverse-[MODULE]:[VERSION]'
}

Gradle (Kotlin DSL)

repositories {
    maven("https://repo.onarandombox.com/content/groups/public/")
}

dependencies {
    compileOnly("com.onarandombox.multiverse[MODULE]:Multiverse-[MODULE]:[VERSION]")
}

Manual

If you wish to download the dependency to classpath, you can do the following:

  1. Navigate to https://repo.onarandombox.com/content/groups/public/com/onarandombox/.
  2. Click into the directory of the Multiverse modules you wish to have.
  3. Select the Multiverse-[MODULE]-[VERSION].jar.

Getting the Multiverse plugin instances

Multiverse-Core:

MultiverseCore core = (MultiverseCore) Bukkit.getServer().getPluginManager().getPlugin("Multiverse-Core");

Multiverse-Inventories

MultiverseInventories inventories = (MultiverseInventories) Bukkit.getServer().getPluginManager().getPlugin("Multiverse-Inventories");

Multiverse-Portals

MultiversePortals portals = (MultiversePortals) Bukkit.getServer().getPluginManager().getPlugin("Multiverse-Portals");

Multiverse-NetherPortals

MultiverseNetherPortals netherportals = (MultiverseNetherPortals) Bukkit.getServer().getPluginManager().getPlugin("Multiverse-NetherPortals");

Useful information

Make sure Multiverse is loaded

To ensure that getting the plugin instance of Multiverse does not result in an NPE, for all the modules you use, you need to add them as depend or softdepend in plugins.yml. As example as follows:

name: FlyPerms
main: dev.benergy10.flyperms
authors: benwoo1110
softdepend: ['Multiverse-Core', 'Multiverse-Inventories']

It is also possible to listen to PluginEnableEvent and PluginDisableEvent to detect when a Multiverse module is enabled/disabled.

Next steps

We have curated a bunch of common usages for the various multiverse modules:

Plugins that uses MV's API

Questions/Help

Feel free to join our discord or open an issue, people who can help will reply ;)

⚠️ **GitHub.com Fallback** ⚠️