Correct garbage collection error for voice chat
This commit is contained in:
parent
d2c8729a87
commit
2473d0d0a4
@ -128,10 +128,10 @@ public class BotListener extends ListenerAdapter {
|
|||||||
super.onGuildVoiceJoin(event);
|
super.onGuildVoiceJoin(event);
|
||||||
if(!event.getMember().getUser().isBot()){
|
if(!event.getMember().getUser().isBot()){
|
||||||
UserStatsUtils userStatsUtils = UserStatsUtils.getINSTANCE();
|
UserStatsUtils userStatsUtils = UserStatsUtils.getINSTANCE();
|
||||||
if(!userStatsUtils.runningCounters.containsKey(event.getMember())){
|
if (!userStatsUtils.runningCounters.containsKey(event.getMember().getId())) {
|
||||||
UserStatsUtils.VoicePresenceCounter temp = new UserStatsUtils.VoicePresenceCounter(event.getMember());
|
UserStatsUtils.VoicePresenceCounter temp = new UserStatsUtils.VoicePresenceCounter(event.getMember());
|
||||||
temp.start();
|
temp.start();
|
||||||
userStatsUtils.runningCounters.put(event.getMember(), temp);
|
userStatsUtils.runningCounters.put(event.getMember().getId(), temp);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -36,11 +35,13 @@ public class UserStatsUtils {
|
|||||||
private static UserStatsUtils INSTANCE = new UserStatsUtils();
|
private static UserStatsUtils INSTANCE = new UserStatsUtils();
|
||||||
|
|
||||||
public static UserStatsUtils getINSTANCE() {
|
public static UserStatsUtils getINSTANCE() {
|
||||||
|
if(INSTANCE == null)
|
||||||
|
INSTANCE = new UserStatsUtils();
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public HashMap<Member, VoicePresenceCounter> runningCounters = new HashMap<>();
|
public HashMap<String, VoicePresenceCounter> runningCounters = new HashMap<>();
|
||||||
|
|
||||||
private UserStatsRepository userStatsRepository;
|
private UserStatsRepository userStatsRepository;
|
||||||
private UserRepository userRepository;
|
private UserRepository userRepository;
|
||||||
@ -281,7 +282,7 @@ public class UserStatsUtils {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UserStatsUtils.getINSTANCE().runningCounters.remove(member);
|
UserStatsUtils.getINSTANCE().runningCounters.remove(member.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user