[英]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.我正在尝试创建一个机器人来检查用户是否尝试进入新的语音通道,但是当尝试覆盖 onVoiceChannelUpdate 方法时,它保持灰色并给我错误,我没有参数类。
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.
我之前有一些方法可以检查消息和所有这些并且它们有效,但是对于我使用的任何其他方法,参数类都不存在。
Tried with onGuildVoiceUpdate method also, but it has the same issue:也尝试使用 onGuildVoiceUpdate 方法,但它有同样的问题:
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.使用 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.如果这不起作用,则可能是您的 IDE 有问题,因此请尝试使您的缓存无效。
You're looking for the GuildVoiceUpdateEvent
instead.您正在寻找
GuildVoiceUpdateEvent
。
@Override
public void onGuildVoiceUpdate(GuildVoiceUpdateEvent event) {
AudioChannel oldChannel = event.getChannelLeft();
AudioChannel newChannel = event.getChannelJoined();
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.