estoy intentando crear un bot de discord con java maven y me gustaria tener el nucleo separado de los comandos, y que el nucleo llame(inicie) a los comandos para que se puedan usar, he intentado llamarlo de la siguiente manera pero no funciona, me da un error de java.lang.NullPoinerException agradeceria que alguien me ayude:
EL NUCLEO
package darkdragon.team.dragonoid;
import net.dv8tion.jda.core.AccountType;
import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.JDABuilder;
import net.dv8tion.jda.core.entities.Game;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
import net.dv8tion.jda.core.hooks.ListenerAdapter;
public class App extends ListenerAdapter
{
public static JDA api;
public static void main( String[] args ) throws Exception
{
api = new JDABuilder(AccountType.BOT).setToken(Ref.token).buildBlocking();
api.addEventListener(new App());
api.getPresence().setGame(Game.playing("MANTENIMIENTO"));
MessageReceivedEvent evt = null;
Commands.processCommand(evt);
}
}
LOS COMANDOS
package darkdragon.team.dragonoid;
import net.dv8tion.jda.core.entities.Message;
import net.dv8tion.jda.core.entities.MessageChannel;
import net.dv8tion.jda.core.entities.User;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
import net.dv8tion.jda.core.hooks.ListenerAdapter;
public class Commands extends ListenerAdapter {
public static void processCommand(MessageReceivedEvent evt) {
User objUser = evt.getAuthor();
Message objMsg = evt.getMessage();
MessageChannel objMsgCh = evt.getChannel();
String[] command = objMsg.getContentRaw().toLowerCase().replaceFirst(Ref.prefix, "").split(" ");
if(command[0].equals("ping")) {
objMsgCh.sendMessage(objUser.getAsMention() + "Pong!");
}
}
}
SALTA EL ERROR
Exception in thread "main" java.lang.NullPointerException