This commit is contained in:
Coloryr committed 2024-05-08 16:25:33 +08:00
1 parent d276319c7a
commit dc86980a04
103 files changed
+2226 -1560

No files matched your search

+31 -34
View File
@@ -17,6 +17,37 @@ public class CommandEX {
public static final Map<String, ICommand> commandList = new HashMap<>();
public static final Map<String, ICommand> commandAdminList = new HashMap<>();
private static final List<String> normal = new ArrayList<String>() {{
this.add("stop");
this.add("cancel");
this.add("list");
this.add("vote");
this.add("mute");
this.add("search");
this.add("hud");
this.add("push");
}};
/**
* 管理员的指令
*/
private static final List<String> admin = new ArrayList<String>() {{
this.add("reload");
this.add("next");
this.add("ban");
this.add("delete");
this.add("addlist");
this.add("clearlist");
this.add("login");
this.add("code");
}};
/**
* 搜歌的指令
*/
private static final List<String> search = new ArrayList<String>() {{
this.add("select");
this.add("nextpage");
this.add("lastpage");
}};
static {
commandList.put("stop", new CommandStop());
@@ -245,40 +276,6 @@ public class CommandEX {
}
}
private static final List<String> normal = new ArrayList<String>() {{
this.add("stop");
this.add("cancel");
this.add("list");
this.add("vote");
this.add("mute");
this.add("search");
this.add("hud");
this.add("push");
}};
/**
* 管理员的指令
*/
private static final List<String> admin = new ArrayList<String>() {{
this.add("reload");
this.add("next");
this.add("ban");
this.add("delete");
this.add("addlist");
this.add("clearlist");
this.add("login");
this.add("code");
}};
/**
* 搜歌的指令
*/
private static final List<String> search = new ArrayList<String>() {{
this.add("select");
this.add("nextpage");
this.add("lastpage");
}};
/**
* 获取Tab指令列表
*
+43 -44
View File
@@ -7,6 +7,17 @@ import com.coloryr.allmusic.server.core.utils.HudUtils;
import java.util.*;
public class CommandHud extends ACommand {
/**
* Hud的指令
*/
private static final List<String> hudlist = new ArrayList<String>() {{
this.add("enable");
this.add("reset");
this.add("info");
this.add("list");
this.add("lyric");
this.add("pic");
}};
private final Map<String, ICommand> commandList = new HashMap<>();
public CommandHud() {
@@ -18,7 +29,39 @@ public class CommandHud extends ACommand {
commandList.put("pic", new CommandHudSet(HudType.PIC));
}
@Override
public void ex(Object sender, String name, String[] args) {
if (args.length == 1) {
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
} else {
ICommand command = commandList.get(args[1]);
if (command != null) {
command.ex(sender, name, args);
} else {
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
}
}
}
@Override
public List<String> tab(String name, String[] args, int index) {
if (args.length == index + 1) {
return hudlist;
} else {
ICommand command = commandList.get(args[index]);
if (command != null) {
return command.tab(name, args, index + 1);
}
}
return Collections.emptyList();
}
public static class HudEnable extends ACommand {
private static final List<String> tf = new ArrayList<String>() {{
this.add("true");
this.add("false");
}};
@Override
public void ex(Object sender, String name, String[] args) {
if (args.length == 2 || args.length == 3) {
@@ -38,11 +81,6 @@ public class CommandHud extends ACommand {
}
return Collections.emptyList();
}
private static final List<String> tf = new ArrayList<String>() {{
this.add("true");
this.add("false");
}};
}
public static class HudReset extends ACommand {
@@ -53,43 +91,4 @@ public class CommandHud extends ACommand {
.replace("%Hud%", AllMusic.getMessage().hudList.getHud(null)));
}
}
@Override
public void ex(Object sender, String name, String[] args) {
if (args.length == 1) {
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
} else {
ICommand command = commandList.get(args[1]);
if (command != null) {
command.ex(sender, name, args);
} else {
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
}
}
}
/**
* Hud的指令
*/
private static final List<String> hudlist = new ArrayList<String>() {{
this.add("enable");
this.add("reset");
this.add("info");
this.add("list");
this.add("lyric");
this.add("pic");
}};
@Override
public List<String> tab(String name, String[] args, int index) {
if (args.length == index + 1) {
return hudlist;
} else {
ICommand command = commandList.get(args[index]);
if (command != null) {
return command.tab(name, args, index + 1);
}
}
return Collections.emptyList();
}
}
+62 -66
View File
@@ -9,6 +9,28 @@ import com.coloryr.allmusic.server.core.utils.HudUtils;
import java.util.*;
public class CommandHudSet extends AHudCommand {
/**
* Hud的指令
*/
private static final List<String> hud = new ArrayList<String>() {{
this.add("enable");
this.add("pos");
this.add("dir");
this.add("reset");
}};
private static final List<String> pic = new ArrayList<String>() {{
this.add("size");
this.add("rotate");
this.add("speed");
}};
private static final List<String> info = new ArrayList<String>() {{
this.add("color");
this.add("shadow");
}};
private static final List<String> tf = new ArrayList<String>() {{
this.add("true");
this.add("false");
}};
private final Map<String, ICommand> commandList = new HashMap<>();
public CommandHudSet(HudType type) {
@@ -27,6 +49,40 @@ public class CommandHudSet extends AHudCommand {
}
}
@Override
public void ex(Object sender, String name, String[] args) {
if (args.length == 1) {
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
} else {
ICommand command = commandList.get(args[2]);
if (command != null) {
command.ex(sender, name, args);
} else {
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
}
}
}
@Override
public List<String> tab(String name, String[] args, int index) {
if (args.length == index + 1) {
List<String> list = new ArrayList<>(hud);
if (type == HudType.PIC) {
list.addAll(pic);
} else {
list.addAll(info);
}
return list;
} else {
ICommand command = commandList.get(args[index]);
if (command != null) {
return command.tab(name, args, index + 1);
}
}
return Collections.emptyList();
}
private static class HudEnable extends AHudCommand {
public HudEnable(HudType type) {
super(type);
@@ -97,6 +153,12 @@ public class CommandHudSet extends AHudCommand {
}
private static class HudDir extends AHudCommand {
private static final List<String> dir = new ArrayList<String>() {{
for (HudDirType type : HudDirType.values()) {
this.add(type.name());
}
}};
public HudDir(HudType type) {
super(type);
}
@@ -117,12 +179,6 @@ public class CommandHudSet extends AHudCommand {
.replace("%Dir%", AllMusic.getMessage().hudList.getDir(type1)));
}
private static final List<String> dir = new ArrayList<String>() {{
for (HudDirType type : HudDirType.values()) {
this.add(type.name());
}
}};
@Override
public List<String> tab(String name, String[] args, int index) {
if (args.length == index + 1) {
@@ -225,64 +281,4 @@ public class CommandHudSet extends AHudCommand {
AllMusic.getMessage().hud.picSpeed.replace("%Size%", args[3]));
}
}
@Override
public void ex(Object sender, String name, String[] args) {
if (args.length == 1) {
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
} else {
ICommand command = commandList.get(args[2]);
if (command != null) {
command.ex(sender, name, args);
} else {
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
}
}
}
/**
* Hud的指令
*/
private static final List<String> hud = new ArrayList<String>() {{
this.add("enable");
this.add("pos");
this.add("dir");
this.add("reset");
}};
private static final List<String> pic = new ArrayList<String>() {{
this.add("size");
this.add("rotate");
this.add("speed");
}};
private static final List<String> info = new ArrayList<String>() {{
this.add("color");
this.add("shadow");
}};
private static final List<String> tf = new ArrayList<String>() {{
this.add("true");
this.add("false");
}};
@Override
public List<String> tab(String name, String[] args, int index) {
if (args.length == index + 1) {
List<String> list = new ArrayList<>(hud);
if (type == HudType.PIC) {
list.addAll(pic);
} else {
list.addAll(info);
}
return list;
} else {
ICommand command = commandList.get(args[index]);
if (command != null) {
return command.tab(name, args, index + 1);
}
}
return Collections.emptyList();
}
}
+1 -1
View File
@@ -39,7 +39,7 @@ public class HttpClientUtil {
public static HttpResObj get(String path, String data) {
try {
data = URLEncoder.encode(data, "UTF-8");
data = URLEncoder.encode(data, StandardCharsets.UTF_8.name());
Request request = new Request.Builder().url(path + data)
.addHeader("referer", "https://music.163.com")
.addHeader("content-type", "application/json;charset=UTF-8")
+1 -2
View File
@@ -56,11 +56,10 @@ public class PlayMusic {
* 错误次数
*/
public static int error;
public static SongInfoObj push;
private static boolean isRun;
private static int idleNow;
public static SongInfoObj push;
/**
* 停止歌曲逻辑
*/
+7 -7
View File
@@ -142,6 +142,13 @@ public class ConfigObj {
*/
public int sendDelay;
public static ConfigObj make() {
ConfigObj config = new ConfigObj();
config.init();
return config;
}
public void addBanMusic(String id) {
banMusic.add(id);
AllMusic.saveConfig();
@@ -237,11 +244,4 @@ public class ConfigObj {
sendDelay = 1000;
version = AllMusic.configVersion;
}
public static ConfigObj make() {
ConfigObj config = new ConfigObj();
config.init();
return config;
}
}
+7 -7
View File
@@ -5,6 +5,13 @@ public class EconomyObj {
public String backend;
public boolean vault;
public static EconomyObj make() {
EconomyObj obj = new EconomyObj();
obj.init();
return obj;
}
public boolean check() {
boolean res = mysqlUrl == null;
@@ -16,11 +23,4 @@ public class EconomyObj {
mysqlUrl = "jdbc:mysql://localhost:3306/minecraft?autoReconnect=true&autoReconnectForPools=true";
vault = true;
}
public static EconomyObj make() {
EconomyObj obj = new EconomyObj();
obj.init();
return obj;
}
}
+5 -5
View File
@@ -4,15 +4,15 @@ public class FunConfigObj {
public boolean rain;
public int rainRate;
public void init() {
rain = true;
rainRate = 10;
}
public static FunConfigObj make() {
FunConfigObj obj = new FunConfigObj();
obj.init();
return obj;
}
public void init() {
rain = true;
rainRate = 10;
}
}
+7 -7
View File
@@ -10,6 +10,13 @@ public class SaveObj {
public PosObj pic;
public int picRotateSpeed;
public static SaveObj make() {
SaveObj obj = new SaveObj();
obj.init();
return obj;
}
public SaveObj copy() {
SaveObj obj1 = new SaveObj();
obj1.info = this.info.copy();
@@ -48,11 +55,4 @@ public class SaveObj {
info = new PosObj(74, 2, HudDirType.TOP_LEFT, 0xffffff, false, true);
pic = new PosObj(2, 2, HudDirType.TOP_LEFT, 70, true, true);
}
public static SaveObj make() {
SaveObj obj = new SaveObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -12,6 +12,13 @@ public class AddMusicObj {
public String cancel;
public String timeOut;
public static AddMusicObj make() {
AddMusicObj obj = new AddMusicObj();
obj.init();
return obj;
}
public boolean check() {
if (listFull == null)
return true;
@@ -46,11 +53,4 @@ public class AddMusicObj {
cancel = "§d[AllMusic3]§e点歌被取消";
timeOut = "§d[AllMusic3]§e点歌被取消,音乐长度过长";
}
public static AddMusicObj make() {
AddMusicObj obj = new AddMusicObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -7,6 +7,13 @@ public class CancelObj {
public String err3;
public String err4;
public static CancelObj make() {
CancelObj obj = new CancelObj();
obj.init();
return obj;
}
public boolean check() {
if (err1 == null)
return true;
@@ -26,11 +33,4 @@ public class CancelObj {
err4 = "§d[AllMusic3]§c输入的序号错误";
done = "§d[AllMusic3]§e已取消你的点歌";
}
public static CancelObj make() {
CancelObj obj = new CancelObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -4,6 +4,13 @@ public class ClickObj {
public String clickRun;
public String clickCheck;
public static ClickObj make() {
ClickObj obj = new ClickObj();
obj.init();
return obj;
}
public boolean check() {
if (clickRun == null)
return true;
@@ -14,11 +21,4 @@ public class ClickObj {
clickRun = "§b[§n点我选择§r§b]";
clickCheck = "§b[§n点我查看§r§b]";
}
public static ClickObj make() {
ClickObj obj = new ClickObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -4,6 +4,13 @@ public class CommandObj {
public String error;
public String noPer;
public static CommandObj make() {
CommandObj obj = new CommandObj();
obj.init();
return obj;
}
public boolean check() {
if (error == null)
return true;
@@ -14,11 +21,4 @@ public class CommandObj {
error = "§d[AllMusic3]§c参数错误,请输入/music help获取帮助";
noPer = "§d[AllMusic3]§c你没有权限执行这个操作";
}
public static CommandObj make() {
CommandObj obj = new CommandObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -6,6 +6,13 @@ public class CostObj {
public String noMoney;
public String costFail;
public static CostObj make() {
CostObj obj = new CostObj();
obj.init();
return obj;
}
public boolean check() {
if (search == null)
return true;
@@ -22,11 +29,4 @@ public class CostObj {
noMoney = "§d[AllMusic3]§c你没有足够的钱";
costFail = "§d[AllMusic3]§c扣钱过程中错误";
}
public static CostObj make() {
CostObj obj = new CostObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -3,6 +3,13 @@ package com.coloryr.allmusic.server.core.objs.message;
public class CustomObj {
public String info;
public static CustomObj make() {
CustomObj obj = new CustomObj();
obj.init();
return obj;
}
public boolean check() {
return info == null;
}
@@ -10,11 +17,4 @@ public class CustomObj {
public void init() {
info = "自定义音乐";
}
public static CustomObj make() {
CustomObj obj = new CustomObj();
obj.init();
return obj;
}
}
+10 -13
View File
@@ -3,23 +3,20 @@ package com.coloryr.allmusic.server.core.objs.message;
public class FunObj {
public String rain;
public boolean check() {
boolean res = false;
if (rain == null) {
res = true;
}
return res;
}
public void init() {
rain = "§d[AllMusic3]§e天空开始变得湿润";
}
public static FunObj make() {
FunObj obj = new FunObj();
obj.init();
return obj;
}
public boolean check() {
boolean res = rain == null;
return res;
}
public void init() {
rain = "§d[AllMusic3]§e天空开始变得湿润";
}
}
+7 -7
View File
@@ -12,6 +12,13 @@ public class HelpAdminObj {
public String login;
public String code;
public static HelpAdminObj make() {
HelpAdminObj obj = new HelpAdminObj();
obj.init();
return obj;
}
public boolean check() {
if (reload == null)
return true;
@@ -46,11 +53,4 @@ public class HelpAdminObj {
login = "§d[AllMusic3]§e使用/music login [验证码] 登录账户";
code = "§d[AllMusic3]§e使用/music code [手机号] 获取短信验证码";
}
public static HelpAdminObj make() {
HelpAdminObj obj = new HelpAdminObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -24,6 +24,13 @@ public class HelpNormalObj {
public String hud9;
public String hud10;
public static HelpNormalObj make() {
HelpNormalObj obj = new HelpNormalObj();
obj.init();
return obj;
}
public boolean check() {
if (head == null)
return true;
@@ -94,11 +101,4 @@ public class HelpNormalObj {
hud4 = "§d[AllMusic3]§e使用/music hud pic rotate [开关] 设置图片旋转模式";
hud5 = "§d[AllMusic3]§e使用/music hud pic speed [数值] 设置图片旋转速度";
}
public static HelpNormalObj make() {
HelpNormalObj obj = new HelpNormalObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -4,6 +4,13 @@ public class HelpObj {
public HelpNormalObj normal;
public HelpAdminObj admin;
public static HelpObj make() {
HelpObj obj = new HelpObj();
obj.init();
return obj;
}
public boolean check() {
boolean save = false;
if (normal == null || normal.check()) {
@@ -21,11 +28,4 @@ public class HelpObj {
normal = HelpNormalObj.make();
admin = HelpAdminObj.make();
}
public static HelpObj make() {
HelpObj obj = new HelpObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -23,6 +23,13 @@ public class HudNameObj {
public String pos8;
public String pos9;
public static HudNameObj make() {
HudNameObj obj = new HudNameObj();
obj.init();
return obj;
}
public boolean check() {
if (list == null)
return true;
@@ -123,11 +130,4 @@ public class HudNameObj {
pos8 = "下";
pos9 = "右下";
}
public static HudNameObj make() {
HudNameObj obj = new HudNameObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -18,6 +18,13 @@ public class HudObj {
public String list;
public String ktv;
public static HudObj make() {
HudObj obj = new HudObj();
obj.init();
return obj;
}
public boolean check() {
if (state == null)
return true;
@@ -70,11 +77,4 @@ public class HudObj {
ktv = "§e%KLyric%§f%Lyric%§r\n%Tlyric%";
list = "播放列表里面有%Size%首歌\n%List%";
}
public static HudObj make() {
HudObj obj = new HudObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -5,6 +5,13 @@ public class ListMusicObj {
public String item;
public String get;
public static ListMusicObj make() {
ListMusicObj obj = new ListMusicObj();
obj.init();
return obj;
}
public boolean check() {
boolean res = head == null;
if (item == null)
@@ -20,11 +27,4 @@ public class ListMusicObj {
item = "§e%Index%->%MusicName% | %MusicAuthor% | %MusicAl% | %MusicAlia%";
get = "§d[AllMusic3]§e歌曲列表%ListName%获取成功";
}
public static ListMusicObj make() {
ListMusicObj obj = new ListMusicObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -7,6 +7,13 @@ public class LyricObj {
public String empty2;
public String empty3;
public static LyricObj make() {
LyricObj obj = new LyricObj();
obj.init();
return obj;
}
public boolean check() {
if (data == null)
return true;
@@ -26,11 +33,4 @@ public class LyricObj {
empty2 = "没有翻译歌词";
empty3 = "没有KTV歌词";
}
public static LyricObj make() {
LyricObj obj = new LyricObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -22,6 +22,13 @@ public class MessageObj {
public CancelObj cancel;
public String version;
public static MessageObj make() {
MessageObj obj = new MessageObj();
obj.init();
return obj;
}
public boolean check() {
boolean saveConfig = false;
if (musicPlay == null || musicPlay.check()) {
@@ -115,11 +122,4 @@ public class MessageObj {
cancel = CancelObj.make();
version = AllMusic.messageVersion;
}
public static MessageObj make() {
MessageObj obj = new MessageObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -15,6 +15,13 @@ public class MusicPlayObj {
public String trail;
public String cancel;
public static MusicPlayObj make() {
MusicPlayObj obj = new MusicPlayObj();
obj.init();
return obj;
}
public boolean check() {
boolean res = stopPlaying == null;
if (emptyPlayingMusic == null)
@@ -60,11 +67,4 @@ public class MusicPlayObj {
trail = "§d[AllMusic3]§e该音乐为试听音乐";
cancel = "§d[AllMusic3]§e播放被取消";
}
public static MusicPlayObj make() {
MusicPlayObj obj = new MusicPlayObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -3,6 +3,13 @@ package com.coloryr.allmusic.server.core.objs.message;
public class PAPIObj {
public String emptyMusic;
public static PAPIObj make() {
PAPIObj obj = new PAPIObj();
obj.init();
return obj;
}
public boolean check() {
return emptyMusic == null;
}
@@ -10,11 +17,4 @@ public class PAPIObj {
public void init() {
emptyMusic = "没有播放的音乐";
}
public static PAPIObj make() {
PAPIObj obj = new PAPIObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -5,6 +5,13 @@ public class PageObj {
public String next;
public String last;
public static PageObj make() {
PageObj obj = new PageObj();
obj.init();
return obj;
}
public boolean check() {
boolean res = choice == null;
if (next == null)
@@ -20,11 +27,4 @@ public class PageObj {
next = "§e[§n点我下一页§r§e]";
last = "§e[§n点我上一页§r§e]";
}
public static PageObj make() {
PageObj obj = new PageObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -20,6 +20,13 @@ public class PushObj {
public String err2;
public String err3;
public static PushObj make() {
PushObj obj = new PushObj();
obj.init();
return obj;
}
public boolean check() {
if (noPermission == null)
return true;
@@ -78,11 +85,4 @@ public class PushObj {
err3 = "§d[AllMusic3]§c发起失败,已经有人发起了插歌投票";
cancel = "§d[AllMusic3]§e插歌投票已被发起者取消";
}
public static PushObj make() {
PushObj obj = new PushObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -11,6 +11,13 @@ public class SearchObj {
public String cantLast;
public String startSearch;
public static SearchObj make() {
SearchObj obj = new SearchObj();
obj.init();
return obj;
}
public boolean check() {
if (noPer == null)
return true;
@@ -42,11 +49,4 @@ public class SearchObj {
cantNext = "§d[AllMusic3]§c无法下一页";
cantLast = "§d[AllMusic3]§c无法上一页";
}
public static SearchObj make() {
SearchObj obj = new SearchObj();
obj.init();
return obj;
}
}
+7 -7
View File
@@ -16,6 +16,13 @@ public class VoteObj {
public String err3;
public String cancel;
public static VoteObj make() {
VoteObj obj = new VoteObj();
obj.init();
return obj;
}
public boolean check() {
if (noPermission == null)
return true;
@@ -62,11 +69,4 @@ public class VoteObj {
voteDone = "§d[AllMusic3]§e已切歌";
cancel = "§d[AllMusic3]§e切歌投票已被发起者取消";
}
public static VoteObj make() {
VoteObj obj = new VoteObj();
obj.init();
return obj;
}
}