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());
}
}
public class InitializeListener implements Listener {
final MainClass main;
public InitializeListener(MainClass main){
this.main = main;
}
@EventHandler
public void onInitialize(ServerAttachedEvent event){
main.setBungeeAPI((DNBungeeAPI) DNBungeeAPI.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;
}
}
public final class MainClass extends Plugin{
private static MainClass instance;
private DNBungeeAPI dnBungeeAPI;
@Override
public void onEnable() {
instance = this;
getProxy().getPluginManager().registerListener(new InitializeListener(this),this);
}
public DNBungeeAPI getBungeeAPI() {
return dnBungeeAPI;
}
public void setBungeeAPI(DNBungee bungeeAPI) {
this.dnSpigotAPI = dnSpigotAPI;
}
public static MainClass getInstance() {
return instance;
}
}