2023-10-22 10:14:55 +08:00
|
|
|
package coloryr.allmusic.core.command;
|
|
|
|
|
|
|
|
|
|
import coloryr.allmusic.core.AllMusic;
|
2024-04-17 22:15:12 +08:00
|
|
|
import coloryr.allmusic.core.music.play.PlayMusic;
|
|
|
|
|
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
2023-10-22 10:14:55 +08:00
|
|
|
import coloryr.allmusic.core.utils.Function;
|
|
|
|
|
|
2024-04-17 22:15:12 +08:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class CommandBan extends ACommand {
|
2023-10-22 10:14:55 +08:00
|
|
|
@Override
|
|
|
|
|
public void ex(Object sender, String name, String[] args) {
|
|
|
|
|
if (args.length != 2) {
|
2024-04-17 22:15:12 +08:00
|
|
|
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
|
2023-10-22 10:14:55 +08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (Function.isInteger(args[1])) {
|
|
|
|
|
AllMusic.getConfig().addBanMusic(args[1]);
|
2024-04-17 22:15:12 +08:00
|
|
|
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2已禁止点歌" + args[1]);
|
2023-10-22 10:14:55 +08:00
|
|
|
} else {
|
2024-04-17 22:15:12 +08:00
|
|
|
AllMusic.side.sendMessage(sender, "§d[AllMusic3]§2请输入有效的ID");
|
2023-10-22 10:14:55 +08:00
|
|
|
}
|
|
|
|
|
}
|
2024-04-17 22:15:12 +08:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> tab(String name, String[] args) {
|
|
|
|
|
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
|
if (PlayMusic.nowPlayMusic != null) {
|
|
|
|
|
list.add(PlayMusic.nowPlayMusic.getID());
|
|
|
|
|
}
|
|
|
|
|
for (SongInfoObj item : PlayMusic.getList()) {
|
|
|
|
|
list.add(item.getID());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
2023-10-22 10:14:55 +08:00
|
|
|
}
|