String[] messageSent = event.getMessage().getContentRaw().split("\\s+");
if (messageSent[0].equalsIgnoreCase("/mute")) {
if (messageSent.length == 2) {
Member member = event.getGuild().getMemberById(messageSent[1].replace("<@", "").replace(">", ""));
Role role = event.getGuild().getRoleById("731166424608931900");
if (!member.getRoles().contains(role)) {
//mute user
event.getChannel().sendMessage("Muted " + messageSent[1] + ".").queue();
event.getGuild().addRoleToMember(member, role);
}else {
//unmute user
event.getChannel().sendMessage("Unmuted " + messageSent[1] + ".").queue();
event.getGuild().removeRoleFromMember(member, role);
}
}else if (messageSent.length == 3) {
}else {
event.getChannel().sendMessage("incorrect syntax i dont have time to make this error message pretty, fuck!").queue();
}
}
, поэтому проблема в том, что
1-й: вероятно, он прерывается в четвертой строке, иначе Member member = event.getGuild().getMemberById(messageSent[1].replace("<@", "").replace(">", ""));
2-й: я получаю эту ошибку [JDA MainWS-ReadThread] ERROR JDA - One of the EventListeners had an uncaught exception java.lang.NullPointerException