From 8a627d755f4c2f65ec2045ea01a7e13465ba4039 Mon Sep 17 00:00:00 2001 From: Coloryr <402067010@qq.com> Date: Fri, 21 Feb 2020 15:46:03 +0800 Subject: [PATCH] done --- .../Color_yr/ALLMusic/Command/CommandBC.java | 15 +++++++-------- .../Color_yr/ALLMusic/Command/CommandBukkit.java | 16 +++++++--------- .../java/Color_yr/ALLMusic/Lyric/LyricDo.java | 2 ++ .../java/Color_yr/ALLMusic/Lyric/LyricOBJ.java | 2 +- src/main/java/Color_yr/ALLMusic/Play/PlayGo.java | 1 + 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/Color_yr/ALLMusic/Command/CommandBC.java b/src/main/java/Color_yr/ALLMusic/Command/CommandBC.java index 895d24d9..845f046d 100644 --- a/src/main/java/Color_yr/ALLMusic/Command/CommandBC.java +++ b/src/main/java/Color_yr/ALLMusic/Command/CommandBC.java @@ -4,7 +4,6 @@ import Color_yr.ALLMusic.ALLMusic; import Color_yr.ALLMusic.ALLMusicBC; import Color_yr.ALLMusic.Play.PlayMusic; import Color_yr.ALLMusic.Utils.Function; -import Color_yr.ALLMusic.Utils.logs; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.TextComponent; @@ -41,10 +40,9 @@ public class CommandBC extends Command implements TabExecutor { return; } else if (ALLMusic.Config.getBanMusic().contains(MusicID)) { sender.sendMessage(new TextComponent("§d[ALLMusic]§c错误,这首歌被禁点了")); - } else if (PlayMusic.PlayList.contains(MusicID)) { - sender.sendMessage(new TextComponent("§d[ALLMusic]§c错误,这首歌已经在队列了")); } else { PlayMusic.AddMusic(MusicID, sender.getName()); + sender.sendMessage(new TextComponent("§d[ALLMusic]§2点歌成功")); } ALLMusic.Config.RemoveNoMusicPlayer(sender.getName()); } else @@ -75,7 +73,7 @@ public class CommandBC extends Command implements TabExecutor { sender.sendMessage(new TextComponent("§d[ALLMusic]§2队列中无歌曲")); } else { sender.sendMessage(new TextComponent("§d[ALLMusic]§2队列中有歌曲数:" + PlayMusic.PlayList.size())); - sender.sendMessage(new TextComponent("§d[ALLMusic]§2当前队列\n" + PlayMusic.getList())); + sender.sendMessage(new TextComponent(PlayMusic.getList())); } } else if (args[0].equalsIgnoreCase("vote")) { if (PlayMusic.PlayList.size() == 0) { @@ -89,6 +87,7 @@ public class CommandBC extends Command implements TabExecutor { } else if (PlayMusic.Vote_time > 0) { if (!PlayMusic.Vote.contains(name)) { PlayMusic.Vote.add(name); + sender.sendMessage(new TextComponent("§d[ALLMusic]§2你已同意")); ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLMusic]§2" + name + "同意切歌,共有" + PlayMusic.Vote.size() + "名玩家同意切歌。")); } else { @@ -123,11 +122,11 @@ public class CommandBC extends Command implements TabExecutor { } else if (args[0].equalsIgnoreCase("delete") && args.length == 2 && ALLMusic.Config.getAdmin().contains(name)) { if (Function.isInteger(args[1])) { - String music = args[1]; - PlayMusic.PlayList.removeIf(info -> info.getID().equalsIgnoreCase(music)); - sender.sendMessage(new TextComponent("§d[ALLMusic]§2已删除" + music)); + int music = Integer.parseInt(args[1]); + PlayMusic.PlayList.remove(music); + sender.sendMessage(new TextComponent("§d[ALLMusic]§2已删除序列" + music)); } else { - sender.sendMessage(new TextComponent("§d[ALLMusic]§2请输入有效的ID")); + sender.sendMessage(new TextComponent("§d[ALLMusic]§2请输入有效的序列ID")); } } else AddMusic(sender, args); diff --git a/src/main/java/Color_yr/ALLMusic/Command/CommandBukkit.java b/src/main/java/Color_yr/ALLMusic/Command/CommandBukkit.java index 652a8232..b7780912 100644 --- a/src/main/java/Color_yr/ALLMusic/Command/CommandBukkit.java +++ b/src/main/java/Color_yr/ALLMusic/Command/CommandBukkit.java @@ -3,9 +3,7 @@ package Color_yr.ALLMusic.Command; import Color_yr.ALLMusic.ALLMusic; import Color_yr.ALLMusic.ALLMusicBC; import Color_yr.ALLMusic.Play.PlayMusic; -import Color_yr.ALLMusic.Song.Info; import Color_yr.ALLMusic.Utils.Function; -import Color_yr.ALLMusic.Utils.logs; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -38,10 +36,9 @@ public class CommandBukkit implements CommandExecutor, TabExecutor { return; } else if (ALLMusic.Config.getBanMusic().contains(MusicID)) { sender.sendMessage("§d[ALLMusic]§c错误,这首歌被禁点了"); - } else if (PlayMusic.PlayList.contains(MusicID)) { - sender.sendMessage("§d[ALLMusic]§c错误,这首歌已经在队列了"); } else { PlayMusic.AddMusic(MusicID, sender.getName()); + sender.sendMessage("§d[ALLMusic]§2点歌成功"); } ALLMusic.Config.RemoveNoMusicPlayer(sender.getName()); } else @@ -74,7 +71,7 @@ public class CommandBukkit implements CommandExecutor, TabExecutor { sender.sendMessage("§d[ALLMusic]§2队列中无歌曲"); } else { sender.sendMessage("§d[ALLMusic]§2队列中有歌曲数:" + PlayMusic.PlayList.size()); - sender.sendMessage("§d[ALLMusic]§2当前队列\n" + PlayMusic.getList()); + sender.sendMessage(PlayMusic.getList()); } } else if (args[0].equalsIgnoreCase("vote")) { if (PlayMusic.PlayList.size() == 0) { @@ -88,6 +85,7 @@ public class CommandBukkit implements CommandExecutor, TabExecutor { } else if (PlayMusic.Vote_time > 0) { if (!PlayMusic.Vote.contains(name)) { PlayMusic.Vote.add(name); + sender.sendMessage("§d[ALLMusic]§2你已同意"); Bukkit.broadcastMessage("§d[ALLMusic]§2" + name + "同意切歌,共有" + PlayMusic.Vote.size() + "名玩家同意切歌。"); } else { @@ -122,11 +120,11 @@ public class CommandBukkit implements CommandExecutor, TabExecutor { } else if (args[0].equalsIgnoreCase("delete") && args.length == 2 && ALLMusic.Config.getAdmin().contains(name)) { if (Function.isInteger(args[1])) { - String music = args[1]; - PlayMusic.PlayList.removeIf(info -> info.getID().equalsIgnoreCase(music)); - sender.sendMessage("§d[ALLMusic]§2已删除" + music); + int music = Integer.parseInt(args[1]); + PlayMusic.PlayList.remove(music); + sender.sendMessage("§d[ALLMusic]§2已删除序列" + music); } else { - sender.sendMessage("§d[ALLMusic]§2请输入有效的ID"); + sender.sendMessage("§d[ALLMusic]§2请输入有效的序列ID"); } } else AddMusic(sender, args); diff --git a/src/main/java/Color_yr/ALLMusic/Lyric/LyricDo.java b/src/main/java/Color_yr/ALLMusic/Lyric/LyricDo.java index 1b9d15c8..af573096 100644 --- a/src/main/java/Color_yr/ALLMusic/Lyric/LyricDo.java +++ b/src/main/java/Color_yr/ALLMusic/Lyric/LyricDo.java @@ -46,6 +46,8 @@ public class LyricDo { continue; if (!Function.isInteger(sec)) continue; + if(min.isEmpty() || sec.isEmpty()) + continue; time = Integer.parseInt(min) * 60 + Integer.parseInt(sec); if (time > 0) time -= ALLMusic.Config.getDelay(); diff --git a/src/main/java/Color_yr/ALLMusic/Lyric/LyricOBJ.java b/src/main/java/Color_yr/ALLMusic/Lyric/LyricOBJ.java index 19283a83..4b41978f 100644 --- a/src/main/java/Color_yr/ALLMusic/Lyric/LyricOBJ.java +++ b/src/main/java/Color_yr/ALLMusic/Lyric/LyricOBJ.java @@ -20,7 +20,7 @@ class lrc { private String lyric; public String getLyric() { - return lyric; + return lyric == null ? "" : lyric; } } class tlyric { diff --git a/src/main/java/Color_yr/ALLMusic/Play/PlayGo.java b/src/main/java/Color_yr/ALLMusic/Play/PlayGo.java index b1de2165..34286140 100644 --- a/src/main/java/Color_yr/ALLMusic/Play/PlayGo.java +++ b/src/main/java/Color_yr/ALLMusic/Play/PlayGo.java @@ -57,6 +57,7 @@ class PlayGo extends Thread { if (PlayMusic.Vote.size() >= ALLMusic.Config.getMinVote() || (players <= ALLMusic.Config.getMinVote() && players == PlayMusic.Vote.size())) { ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLMusic]§2" + "已切歌")); ALLMusic.Side.Send("[Stop]", false); + PlayMusic.Vote.clear(); PlayMusic.MusicAllTime = 1; if (PlayMusic.PlayList.size() == 0) { ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLMusic]§2" + "队列中无歌曲"));