mirror of
https://github.com/Coloryr/AllMusic.git
synced 2026-11-25 02:54:22 +00:00
测试
This commit is contained in:
1 parent
29b99ea4f0
commit
9c2eee6375
3 files changed
+41
No files matched your search
@@ -12,6 +12,8 @@ import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static Color_yr.ALLmusic.PlayMusic.PlayMusic_Start;
|
||||
|
||||
public class ALLmusic_BC extends Plugin {
|
||||
|
||||
public static String Version = "1.0.0";
|
||||
@@ -65,6 +67,7 @@ public class ALLmusic_BC extends Plugin {
|
||||
log.info("§d[ALLmusic_BC]§e正在启动,感谢使用,本插件交流群:571239090");
|
||||
setConfig();
|
||||
reloadConfig();
|
||||
PlayMusic_Start();
|
||||
ProxyServer.getInstance().getPluginManager().registerListener(this, new ChannelListener());
|
||||
ProxyServer.getInstance().registerChannel("ALLmusic_BC");
|
||||
ProxyServer.getInstance().getPluginManager().registerCommand(this, new command());
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package Color_yr.ALLmusic;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PlayMusic {
|
||||
static Map<String, String> playlist = new HashMap<String, String>();
|
||||
static Runnable playgo = new playgo();
|
||||
public static void PlayMusic_Start()
|
||||
{
|
||||
playgo.run();
|
||||
}
|
||||
}
|
||||
|
||||
class playgo implements Runnable {
|
||||
public synchronized void run() {
|
||||
while (true) {
|
||||
if (PlayMusic.playlist.size() == 0) {
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException e) {
|
||||
e.getMessage();
|
||||
}
|
||||
} else {
|
||||
Iterator<String> iterator = PlayMusic.playlist.keySet().iterator();
|
||||
String key = iterator.next();
|
||||
String playsong = PlayMusic.playlist.get(key);
|
||||
ChannelListener.sendToBukkit("play", playsong);
|
||||
PlayMusic.playlist.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,5 +44,8 @@ public class command extends Command {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(args[0].equalsIgnoreCase("stop")) {
|
||||
ChannelListener.sendToBukkit("stpo", sender.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user