Skip to main content

1. Setup & Integration

UmTo use GWorld v2 in deinemyour Pluginplugin, zuyou nutzen,must musstadd duit esas alsa Abhängigkeit (Dependency) hinzufügen.dependency.

1. Maven Dependency

FügeAdd dasthe core-Modul vonmodule from GWorld into deineyour pom.xml. ein.Since Da diethe API zuris Laufzeitprovided vomby Serverthe bereitgestelltserver wird,at nutzenruntime, wirwe denuse Scopethe provided. scope.


<dependency>
    <groupId>de.gilljan.gworld</groupId>
    <artifactId>gworld-core</artifactId>
    <version>2.0.0</version>
    <scope>provided</scope>
</dependency>

2. plugin.yml

DamitTo deinensure Pluginthat sicheryour aufplugin GWorldcan zugreifenaccess kann,GWorld, mussit esmust be loaded nachafter GWorldGWorld. geladenTo werden.do Fügethis, dazuadd denthe Eintragentry into deineyour plugin.yml hinzu::

depend: [GWorld]
# Alternativ,Alternatively, wennif GWorld optionalis ist:optional:
# softdepend: [GWorld]

3. ZugriffAccess aufto diethe API

DerThe Haupteinstiegspunktmain istentry daspoint Interfaceis the GWorldAPI. Duinterface. erhältstYou diecan Instanzobtain überthe dieinstance statischeusing Methodethe derstatic Hauptklasse.method of the main class.

import de.gilljan.gworld.GWorld;
import de.gilljan.gworld.api.GWorldAPI;
import de.gilljan.gworld.api.IWorldManager;

public class MyPlugin extends JavaPlugin {
    
    private IWorldManager worldManager;

    @Override
    public void onEnable() {
        if (Bukkit.getPluginManager().isPluginEnabled("GWorld")) {
            // Retrieve API Instanz abrufeninstance
            GWorldAPI api = GWorld.getInstance();
            
            // DenLoad Managerthe fürmanager Weltenfor ladenworlds
            this.worldManager = api.getWorldManager();
        }
    }
}