Page cover

Setup

This page help you to configurate and setup the plugin of DreamNetwork

Step 1: Adding JAR file into the project

<dependency>
            <groupId>be.alexandre01.dreamnetwork</groupId>
            <artifactId>DreamNetwork-Plugin</artifactId>
            <version>1.3.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/DreamNetwork-Plugin-api.jar</systemPath>
</dependency>

You need to set the code block in your dependencies inside your pom.xml

Step 2: Create and register a Bukkit/Bungee Listener

Create Listener class

public class InitializeListener implements Listener {
    final MainClass main;
    public InitializeListener(MainClass main){
        this.main = main;
    }
    @EventHandler
    public void onInitialize(ServerAttachedEvent event){
        main.setSpigotAPI((DNSpigotAPI) DNSpigotAPI.getInstance());
    }
}

Register Listener

public final class MainClass extends JavaPlugin {
    private static MainClass instance;
    private DNSpigotAPI dnSpigotAPI;

    @Override
    public void onEnable() {
        instance = this;
        getServer().getPluginManager().registerEvents(new InitializeListener(this),this);
    }

    public DNSpigotAPI getSpigotAPI() {
        return dnSpigotAPI;
    }

    public void setSpigotAPI(DNSpigotAPI dnSpigotAPI) {
        this.dnSpigotAPI = dnSpigotAPI;
    }
    public static MainClass getInstance() {
        return instance;
    }
}

Last updated

Was this helpful?