mirror of
https://github.com/Coloryr/AllMusic.git
synced 2026-11-25 11:04:26 +00:00
增加不参与点歌
This commit is contained in:
1 parent
070a67ced0
commit
34235194fc
2 files changed
+21
-11
No files matched your search
@@ -22,8 +22,9 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import java.util.Map;
|
||||
|
||||
public class PlayMusic {
|
||||
static Map<String, String> playlist = new HashMap<String, String>();
|
||||
static Map<Integer, String> playlist = new HashMap<Integer, String>();
|
||||
public static Map<String, String> Vote = new HashMap<String, String>();
|
||||
public static Map<String, Integer> stop = new HashMap<String, Integer>();
|
||||
|
||||
public static int Vote_time = 0;
|
||||
public static int All_music = 0;
|
||||
@@ -41,6 +42,7 @@ public class PlayMusic {
|
||||
Iterator<ProxiedPlayer> iterator = values.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ProxiedPlayer players = iterator.next();
|
||||
if(stop.get(players.getDisplayName())!=2)
|
||||
players.sendData("AudioBuffer", data.getBytes());
|
||||
}
|
||||
}
|
||||
@@ -93,14 +95,14 @@ public class PlayMusic {
|
||||
class playgo extends Thread {
|
||||
public static void music_list() {
|
||||
if (PlayMusic.playlist.size() == 1) {
|
||||
String a = PlayMusic.playlist.get("1");
|
||||
PlayMusic.playlist.put("0", a);
|
||||
PlayMusic.playlist.remove("1");
|
||||
String a = PlayMusic.playlist.get(1);
|
||||
PlayMusic.playlist.put(0, a);
|
||||
PlayMusic.playlist.remove(1);
|
||||
} else if (PlayMusic.playlist.size() > 1) {
|
||||
int i = 0;
|
||||
for (; PlayMusic.playlist.size() - 1 > i; i++) {
|
||||
String a = PlayMusic.playlist.get(String.valueOf(i + 1));
|
||||
PlayMusic.playlist.put(String.valueOf(i), a);
|
||||
PlayMusic.playlist.put(i, a);
|
||||
}
|
||||
PlayMusic.playlist.remove(String.valueOf(PlayMusic.All_music - 1));
|
||||
}
|
||||
@@ -116,13 +118,13 @@ class playgo extends Thread {
|
||||
e.getMessage();
|
||||
}
|
||||
} else {
|
||||
String playsong = PlayMusic.playlist.get("0");
|
||||
String playsong = PlayMusic.playlist.get(0);
|
||||
String song = PlayMusic.realURL(ALLmusic_BC.Music_Api1 + playsong);
|
||||
if (song != null) {
|
||||
PlayMusic.Music_time = PlayMusic.Music_Time(song);
|
||||
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic]§2" + "正在播放歌曲" + playsong));
|
||||
PlayMusic.SendToPlayer("[Net]" + song);
|
||||
PlayMusic.playlist.remove("0");
|
||||
PlayMusic.playlist.remove(0);
|
||||
music_list();
|
||||
try {
|
||||
while (PlayMusic.Music_time > 0) {
|
||||
@@ -147,7 +149,7 @@ class playgo extends Thread {
|
||||
}
|
||||
} else {
|
||||
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic]§2" + "无效歌曲歌曲" + playsong));
|
||||
PlayMusic.playlist.remove("0");
|
||||
PlayMusic.playlist.remove(0);
|
||||
music_list();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,10 @@ public class command extends Command {
|
||||
sender.sendMessage(new TextComponent("§d[ALLmusic]§c错误,这首歌已经在队列了"));
|
||||
return;
|
||||
}
|
||||
PlayMusic.playlist.put(String.valueOf(PlayMusic.All_music), music_id);
|
||||
if (PlayMusic.stop.get(sender.getName()) == 2) {
|
||||
PlayMusic.stop.put(sender.getName(), 1);
|
||||
}
|
||||
PlayMusic.playlist.put(PlayMusic.All_music, music_id);
|
||||
PlayMusic.All_music++;
|
||||
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic]§2" + sender.getName() +
|
||||
"点歌" + music_id));
|
||||
@@ -72,6 +75,7 @@ public class command extends Command {
|
||||
sender.sendMessage(new TextComponent("§d[ALLmusic]§2使用/music stop 停止播放歌曲"));
|
||||
sender.sendMessage(new TextComponent("§d[ALLmusic]§2使用/music now 查看歌曲队列"));
|
||||
sender.sendMessage(new TextComponent("§d[ALLmusic]§2使用/music vote 投票切歌"));
|
||||
sender.sendMessage(new TextComponent("§d[ALLmusic]§2使用/music nomusic 不再参与点歌"));
|
||||
return;
|
||||
} else if (args[0].equalsIgnoreCase("stop")) {
|
||||
PlayMusic.SendToOnePlayer("[Stop]", sender.getName());
|
||||
@@ -81,9 +85,9 @@ public class command extends Command {
|
||||
sender.sendMessage(new TextComponent("§d[ALLmusic]§2队列中无歌曲"));
|
||||
}
|
||||
sender.sendMessage(new TextComponent("§d[ALLmusic]§2队列中有歌曲数:" + PlayMusic.playlist.size()));
|
||||
Iterator<String> iterator = PlayMusic.playlist.keySet().iterator();
|
||||
Iterator<Integer> iterator = PlayMusic.playlist.keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
Integer key = iterator.next();
|
||||
sender.sendMessage(new TextComponent("§d[ALLmusic]§2当前队列" + key + "->" + PlayMusic.playlist.get(key)));
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("vote")) {
|
||||
@@ -111,6 +115,10 @@ public class command extends Command {
|
||||
PlayMusic.Music_time = 1;
|
||||
PlayMusic.SendToPlayer("[Stop]");
|
||||
sender.sendMessage(new TextComponent("§d[ALLmusic]§2已切歌"));
|
||||
} else if (args[0].equalsIgnoreCase("nomusic")) {
|
||||
PlayMusic.stop.put(sender.getName(), 2);
|
||||
PlayMusic.SendToOnePlayer("[Stop]", sender.getName());
|
||||
sender.sendMessage(new TextComponent("§d[ALLmusic]§2你不会再收到点歌了!"));
|
||||
} else
|
||||
add_music(sender, args);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user