Search code examples
javadiscord-jda

JDA override method is grayed out


I am trying to create a bot that checks if a user attempts to enter a new voice channel, but when trying to override the onVoiceChannelUpdate method, it stays grayed out and gives me error that I don't have the parameters class.

This is the code I have for this method:

@Override
public void onVoiceChannelUpdate(VoiceChannelUpdateEvent event) {
    User user = event.getUser();
    VoiceChannel oldVoiceChannel = event.getOldVoiceChannel();
    VoiceChannel newVoiceChannel = event.getNewVoiceChannel();
    if (checkUserVoiceChannelRequest(user, oldVoiceChannel)) {
        System.out.println(user.getName() + " has left the voice channel " + oldVoiceChannel.getName() + " and entered " + newVoiceChannel.getName() + ".");
    }
}

I tried multiple ways of doing it, but all the methods have the exact same problem. I have some methods from before that check messages and all that and they work, but for any of the other methods that I use, the parameter class is not existent.

Errors showing: enter image description here

enter image description here

Tried with onGuildVoiceUpdate method also, but it has the same issue: enter image description here


Solution

  • can you try

    public class Test extends ListenerAdapter {
        @Override
        public void onGuildVoiceUpdate(GuildVoiceUpdateEvent event) {
            AudioChannel oldChannel = event.getChannelLeft();
            AudioChannel newChannel = event.getChannelJoined();
        }
    }
    

    Using JDA 5.0.0-beta.2.

    If that does not work it might be an issue with your IDE so try to invalidate your cache.