fix(idle_music): update get music randomly
This commit is contained in:
parent
eecc3178b1
commit
219f43243d
@ -24,6 +24,7 @@ import java.util.*;
|
||||
|
||||
public class AllMusic {
|
||||
public static final Gson gson = new Gson();
|
||||
public static final Random random = new Random();
|
||||
|
||||
/**
|
||||
* 客户端插件信道名
|
||||
|
@ -471,6 +471,7 @@ public class PlayMusic {
|
||||
}
|
||||
|
||||
public static void clearIdleList() {
|
||||
deep.clear();
|
||||
playIdleList.clear();
|
||||
DataSql.clearIdleList();
|
||||
}
|
||||
@ -499,16 +500,16 @@ public class PlayMusic {
|
||||
if (size > playIdleList.size() / 2) {
|
||||
size = playIdleList.size() / 2;
|
||||
}
|
||||
if (deep.size() >= size) {
|
||||
while (deep.size() >= size) {
|
||||
deep.poll();
|
||||
}
|
||||
do {
|
||||
id = playIdleList.get(new Random().nextInt(playIdleList.size()));
|
||||
id = playIdleList.get(AllMusic.random.nextInt(playIdleList.size()));
|
||||
}
|
||||
while (deep.contains(id));
|
||||
deep.add(id);
|
||||
} else {
|
||||
id = playIdleList.get(new Random().nextInt(playIdleList.size()));
|
||||
id = playIdleList.get(AllMusic.random.nextInt(playIdleList.size()));
|
||||
}
|
||||
} else {
|
||||
id = playIdleList.get(idleNow);
|
||||
|
Loading…
x
Reference in New Issue
Block a user