mirror of
https://github.com/Coloryr/AllMusic.git
synced 2026-11-25 02:54:22 +00:00
改进
This commit is contained in:
1 parent
198dc07f3a
commit
712375a76a
3 files changed
+13
-14
No files matched your search
@@ -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
|
||||
|
||||
@@ -23,11 +23,12 @@ import java.util.Map;
|
||||
|
||||
public class PlayMusic {
|
||||
static Map<String, String> playlist = new HashMap<String, String>();
|
||||
static Thread playgo = new playgo();
|
||||
private static Integer warningTimes;
|
||||
public static int All_music = 0;
|
||||
public static Map<String, String> Vote = new HashMap<String, String>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user