This commit is contained in:
Color_yr committed 2019-03-24 16:19:32 +08:00
1 parent 755b479ed7
commit 6079a3302a
3 files changed
+39 -34

No files matched your search

@@ -23,14 +23,11 @@ public class ChannelListener implements Listener {
ServerInfo server = ProxyServer.getInstance().getPlayer(e.getReceiver().toString()).getServer().getInfo();
String input = in.readUTF(); // the inputstring
if (input.equals("test")) {
}
}
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
@@ -45,9 +42,9 @@ public class ChannelListener implements Listener {
}
Map<String, ServerInfo> Server = ProxyServer.getInstance().getServers();
Collection<ServerInfo> values = Server.values();
Iterator<ServerInfo> iterator2 = values.iterator();
while (iterator2.hasNext()) {
ServerInfo server = iterator2.next();
Iterator<ServerInfo> iterator = values.iterator();
while (iterator.hasNext()) {
ServerInfo server = iterator.next();
server.sendData("ALLmusic", stream.toByteArray());
}
}
+34 -28
View File
@@ -23,6 +23,7 @@ public class PlayMusic {
public static int All_music = 0;
public static Map<String, String> Vote = new HashMap<String, String>();
public static int Vote_time = 0;
public static void PlayMusic_Start() {
playgo.start();
}
@@ -59,16 +60,13 @@ public class PlayMusic {
if (connection == null) {
var5.printStackTrace();
return null;
} else {
if (warningTimes > 0) {
Integer var3 = warningTimes;
warningTimes = warningTimes - 1;
ALLmusic_BC.log.warning("> 警告: 网页请求反馈出错.");
}
return connection.getURL().toString();
}
} catch (NullPointerException e) {
e.getMessage();
return null;
}
return null;
}
}
@@ -100,30 +98,38 @@ class playgo extends Thread {
} else {
String playsong = PlayMusic.playlist.get("0");
String song = PlayMusic.realURL("http://music.163.com/song/media/outer/url?id=" + playsong);
int Music_time = PlayMusic.Music_Time(song);
ChannelListener.sendToBukkit("play", playsong);
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic_BC]§2" + "正在播放歌曲" + playsong));
PlayMusic.playlist.remove("0");
music_list();
try {
while (Music_time > 0) {
Thread.sleep(1000);
Music_time--;
if(PlayMusic.Vote_time>0) {
PlayMusic.Vote_time--;
if (PlayMusic.Vote.size() >= ProxyServer.getInstance().getOnlineCount()) {
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic_BC]§2" + "已切歌"));
ChannelListener.sendToBukkit("stopALL", "");
Music_time = 0;
if (PlayMusic.All_music == 0) {
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic_BC]§2" + "队列中无歌曲"));
if(song!=null) {
int Music_time = PlayMusic.Music_Time(song);
ChannelListener.sendToBukkit("play", playsong);
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic_BC]§2" + "正在播放歌曲" + playsong));
PlayMusic.playlist.remove("0");
music_list();
try {
while (Music_time > 0) {
Thread.sleep(1000);
Music_time--;
if (PlayMusic.Vote_time > 0) {
PlayMusic.Vote_time--;
if (PlayMusic.Vote.size() >= ProxyServer.getInstance().getOnlineCount()) {
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic_BC]§2" + "已切歌"));
ChannelListener.sendToBukkit("stopALL", "");
Music_time = 0;
if (PlayMusic.All_music == 0) {
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic_BC]§2" + "队列中无歌曲"));
}
PlayMusic.Vote_time = 0;
}
PlayMusic.Vote_time=0;
}
}
} catch (InterruptedException e) {
e.getMessage();
}
} catch (InterruptedException e) {
e.getMessage();
}
else
{
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic_BC]§2" + "无效歌曲歌曲" + playsong));
PlayMusic.playlist.remove("0");
music_list();
}
}
}
@@ -38,6 +38,8 @@ public class command extends Command {
if (isInteger(args[1]) == true) {
PlayMusic.playlist.put(String.valueOf(PlayMusic.All_music), args[1]);
PlayMusic.All_music++;
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic_BC]§2" + sender.getName()+
"点歌"+args[1]));
sender.sendMessage(new TextComponent("§d[ALLmusic_BC]§2已添加" + args[1]));
} else
sender.sendMessage(new TextComponent("§d[ALLmusic_BC]§c错误,请输入歌曲数字ID"));