diff --git a/src/main/java/Color_yr/ALLmusic/ALLmusic_BC.java b/src/main/java/Color_yr/ALLmusic/ALLmusic_BC.java index d3984747..a01f8c93 100644 --- a/src/main/java/Color_yr/ALLmusic/ALLmusic_BC.java +++ b/src/main/java/Color_yr/ALLmusic/ALLmusic_BC.java @@ -87,7 +87,6 @@ public class ALLmusic_BC extends Plugin { PlayMusic_Start(); ProxyServer.getInstance().getPluginManager().registerCommand(this, new command()); log.info("§d[ALLmusic]§e已启动-" + Version); - ; } @Override diff --git a/src/main/java/Color_yr/ALLmusic/PlayMusic.java b/src/main/java/Color_yr/ALLmusic/PlayMusic.java index 7dc3a445..bc78ddde 100644 --- a/src/main/java/Color_yr/ALLmusic/PlayMusic.java +++ b/src/main/java/Color_yr/ALLmusic/PlayMusic.java @@ -23,11 +23,12 @@ import java.util.Map; public class PlayMusic { static Map playlist = new HashMap(); - static Thread playgo = new playgo(); - private static Integer warningTimes; - public static int All_music = 0; public static Map Vote = new HashMap(); + public static int Vote_time = 0; + public static int All_music = 0; + + static Thread playgo = new playgo(); public static void PlayMusic_Start() { playgo.start(); @@ -83,7 +84,6 @@ public class PlayMusic { } catch (NullPointerException e) { e.getMessage(); return null; - } return null; } diff --git a/src/main/java/Color_yr/ALLmusic/command.java b/src/main/java/Color_yr/ALLmusic/command.java index a3388e42..d3da7c2e 100644 --- a/src/main/java/Color_yr/ALLmusic/command.java +++ b/src/main/java/Color_yr/ALLmusic/command.java @@ -20,7 +20,8 @@ public class command extends Command { return pattern.matcher(str).matches(); } - public void add_music(CommandSender sender, String[] args) { ; + public void add_music(CommandSender sender, String[] args) { + ; String music_id = null; if (isInteger(args[0]) == true) { music_id = args[0]; @@ -30,6 +31,9 @@ public class command extends Command { } else if (ALLmusic_BC.Banconfig.getBoolean(music_id, false) == true) { sender.sendMessage(new TextComponent("§d[ALLmusic]§c错误,这首歌被禁点了")); return; + }else if(PlayMusic.playlist.containsValue(music_id)) { + sender.sendMessage(new TextComponent("§d[ALLmusic]§c错误,这首歌已经在队列了")); + return; } PlayMusic.playlist.put(String.valueOf(PlayMusic.All_music), music_id); PlayMusic.All_music++; @@ -77,6 +81,7 @@ public class command extends Command { "发起了切歌投票,10秒后结束,输入/music vote 同意切歌。")); } else if (PlayMusic.Vote_time > 0) { if (PlayMusic.Vote.get(sender.getName()) != "true") { + PlayMusic.Vote_time = 10; PlayMusic.Vote.put(sender.getName(), "true"); ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic]§2" + sender.getName() + "同意切歌,共有" + PlayMusic.Vote.size() + "名玩家同意切歌。")); @@ -86,14 +91,9 @@ public class command extends Command { ALLmusic_BC.reloadConfig(); sender.sendMessage(new TextComponent("§d[ALLmusic]§2已重读配置文件")); } else if (args[0].equalsIgnoreCase("next") && sender.hasPermission("ALLmusic.admin")) { - if (PlayMusic.Vote_time <= 3) { - sender.sendMessage(new TextComponent("§d[ALLmusic]§2剩余时长过短")); - return; - } else { - PlayMusic.Vote_time = 0; - PlayMusic.SendToPlayer("[Stop]"); - sender.sendMessage(new TextComponent("§d[ALLmusic]§2已切歌")); - } + PlayMusic.Vote_time = 0; + PlayMusic.SendToPlayer("[Stop]"); + sender.sendMessage(new TextComponent("§d[ALLmusic]§2已切歌")); } else add_music(sender, args); }