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();
}
}