修改bug

This commit is contained in:
Color_yr committed 2019-08-14 19:18:39 +08:00
1 parent b6f758041a
commit bf1f9b94a9
3 files changed
+16 -9

No files matched your search

@@ -44,7 +44,7 @@ public class ALLmusic_BC extends Plugin {
Collection<String> b = a.getKeys();
for (String c : b) {
boolean d = a.getBoolean(c, false);
PlayMusic.stop.put(c, d);
PlayMusic.stop.put(c, String.valueOf(d));
log.info("玩家:" + c + "的点歌状态:" + !d);
}
}
@@ -21,7 +21,7 @@ public class PlayMusic {
public static Map<Integer, String> playlist = new HashMap<Integer, String>();
public static List<String> Vote = new ArrayList<String>();
public static Map<String, Boolean> stop = new HashMap<String, Boolean>();
public static Map<String, String> stop = new HashMap<String, String>();
public static int Vote_time = 0;
public static int All_music = 0;
@@ -39,8 +39,8 @@ public class PlayMusic {
Iterator<ProxiedPlayer> iterator = values.iterator();
while (iterator.hasNext()) {
ProxiedPlayer players = iterator.next();
if (stop.size() != 0) {
if (!stop.get(players.getName()).booleanValue())
if (stop.containsKey(players.getName())) {
if (!stop.get(players.getName()).equalsIgnoreCase("true"))
players.sendData("AudioBuffer", data.getBytes());
} else
players.sendData("AudioBuffer", data.getBytes());
@@ -110,7 +110,7 @@ class playgo extends Thread {
a = PlayMusic.playlist.get(i + 1);
PlayMusic.playlist.put(i, a);
}
PlayMusic.playlist.remove(PlayMusic.All_music - 1);
PlayMusic.playlist.remove(PlayMusic.playlist.size() - 1);
}
PlayMusic.All_music = PlayMusic.playlist.size();
}
@@ -143,7 +143,7 @@ class playgo extends Thread {
if (PlayMusic.Vote.size() >= ALLmusic_BC.min_vote || (players < ALLmusic_BC.min_vote && players == PlayMusic.Vote.size())) {
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic]§2" + "已切歌"));
PlayMusic.SendToPlayer("[Stop]");
PlayMusic.Music_time = 0;
PlayMusic.Music_time = 1;
if (PlayMusic.All_music == 0) {
ProxyServer.getInstance().broadcast(new TextComponent("§d[ALLmusic]§2" + "队列中无歌曲"));
}
+10 -3
View File
@@ -34,7 +34,7 @@ public class command extends Command {
public void add_music(CommandSender sender, String[] args) {
String music_id;
if (args[0].indexOf("id=") == 0) {
if (args[0].indexOf("id=") != -1) {
if (args[0].indexOf("&user") != -1)
music_id = get_string(args[0], "id=", "&user");
else
@@ -58,7 +58,14 @@ public class command extends Command {
logs logs = new logs();
logs.log_write("玩家:" + sender.getName() + " 点歌:" + music_id);
}
PlayMusic.stop.put(sender.getName(), false);
PlayMusic.stop.put(sender.getName(), "false");
ALLmusic_BC.config.set("nomusic", PlayMusic.stop);
try {
ConfigurationProvider.getProvider(YamlConfiguration.class).save(ALLmusic_BC.config, ALLmusic_BC.FileName);
} catch (Exception e) {
logs log = new logs();
log.log_write(e.getMessage());
}
} else
sender.sendMessage(new TextComponent("§d[ALLmusic]§c错误,请输入歌曲数字ID"));
}
@@ -118,7 +125,7 @@ public class command extends Command {
PlayMusic.SendToPlayer("[Stop]");
sender.sendMessage(new TextComponent("§d[ALLmusic]§2已强制切歌"));
} else if (args[0].equalsIgnoreCase("nomusic")) {
PlayMusic.stop.put(sender.getName(), true);
PlayMusic.stop.put(sender.getName(), "true");
PlayMusic.SendToOnePlayer("[Stop]", sender.getName());
sender.sendMessage(new TextComponent("§d[ALLmusic]§2你不会再收到点歌了!想要再次参与点歌就点一首歌吧!"));
ALLmusic_BC.config.set("nomusic", PlayMusic.stop);