Compare commits
2 Commits
eecc3178b1
...
5311716574
Author | SHA1 | Date | |
---|---|---|---|
5311716574 | |||
219f43243d |
@ -5,7 +5,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "io.github.thehrz.allmusicreload"
|
group = "io.github.thehrz.allmusicreload"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -24,6 +24,7 @@ import java.util.*;
|
|||||||
|
|
||||||
public class AllMusic {
|
public class AllMusic {
|
||||||
public static final Gson gson = new Gson();
|
public static final Gson gson = new Gson();
|
||||||
|
public static final Random random = new Random();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户端插件信道名
|
* 客户端插件信道名
|
||||||
|
@ -5,7 +5,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public abstract class ACommand implements ICommand {
|
public abstract class ACommand implements ICommand {
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class CommandBan extends ACommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == index || (args.length == index + 1 && args[index].isEmpty())) {
|
if (args.length == index || (args.length == index + 1 && args[index].isEmpty())) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
if (PlayMusic.nowPlayMusic != null) {
|
if (PlayMusic.nowPlayMusic != null) {
|
||||||
|
@ -18,7 +18,7 @@ public class CommandBanPlayer implements ICommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == index || (args.length == index + 1 && args[index].isEmpty())) {
|
if (args.length == index || (args.length == index + 1 && args[index].isEmpty())) {
|
||||||
return AllMusic.side.getPlayerList();
|
return AllMusic.side.getPlayerList();
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class CommandCancel implements ICommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
List<SongInfoObj> list1 = PlayMusic.getList();
|
List<SongInfoObj> list1 = PlayMusic.getList();
|
||||||
|
@ -33,7 +33,7 @@ public class CommandDelete extends ACommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
for (int a = 0; a < PlayMusic.getListSize(); a++) {
|
for (int a = 0; a < PlayMusic.getListSize(); a++) {
|
||||||
|
@ -153,12 +153,11 @@ public class CommandEX {
|
|||||||
if (args[0].contains("id=") && !args[0].contains("/?userid")) {
|
if (args[0].contains("id=") && !args[0].contains("/?userid")) {
|
||||||
if (args[0].contains("&uct2")) {
|
if (args[0].contains("&uct2")) {
|
||||||
musicID = Function.getString(args[0], "id=", "&uct2");
|
musicID = Function.getString(args[0], "id=", "&uct2");
|
||||||
}
|
} else if (args[0].contains("&user"))
|
||||||
else if (args[0].contains("&user"))
|
|
||||||
musicID = Function.getString(args[0], "id=", "&user");
|
musicID = Function.getString(args[0], "id=", "&user");
|
||||||
else
|
else
|
||||||
musicID = Function.getString(args[0], "id=", null);
|
musicID = Function.getString(args[0], "id=", null);
|
||||||
} else if (args[0].contains("song/")) {
|
} else if (args[0].contains("song/")) {
|
||||||
if (args[0].contains("/?userid"))
|
if (args[0].contains("/?userid"))
|
||||||
musicID = Function.getString(args[0], "song/", "/?userid");
|
musicID = Function.getString(args[0], "song/", "/?userid");
|
||||||
else
|
else
|
||||||
@ -213,7 +212,7 @@ public class CommandEX {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -263,11 +262,11 @@ public class CommandEX {
|
|||||||
* @param arg 参数
|
* @param arg 参数
|
||||||
* @return 指令列表
|
* @return 指令列表
|
||||||
*/
|
*/
|
||||||
public static List<String> getTabList(String name, String[] arg) {
|
public static List<String> getTabList(Object sender, String name, String[] arg) {
|
||||||
List<String> arguments = new ArrayList<>();
|
List<String> arguments = new ArrayList<>();
|
||||||
if (arg.length == 0) {
|
if (arg.length == 0) {
|
||||||
arguments.addAll(normal);
|
arguments.addAll(normal);
|
||||||
if (AllMusic.side.checkPermission(name)) {
|
if (AllMusic.side.checkPermission(sender)) {
|
||||||
arguments.addAll(admin);
|
arguments.addAll(admin);
|
||||||
}
|
}
|
||||||
if (AllMusic.getSearch(name) != null) {
|
if (AllMusic.getSearch(name) != null) {
|
||||||
@ -276,7 +275,7 @@ public class CommandEX {
|
|||||||
} else {
|
} else {
|
||||||
if (arg[0] == null || arg[0].isEmpty() || arg.length == 1) {
|
if (arg[0] == null || arg[0].isEmpty() || arg.length == 1) {
|
||||||
arguments.addAll(normal);
|
arguments.addAll(normal);
|
||||||
if (AllMusic.side.checkPermission(name)) {
|
if (AllMusic.side.checkPermission(sender)) {
|
||||||
arguments.addAll(admin);
|
arguments.addAll(admin);
|
||||||
}
|
}
|
||||||
if (arg[0] == null || arg[0].isEmpty()) {
|
if (arg[0] == null || arg[0].isEmpty()) {
|
||||||
@ -287,12 +286,12 @@ public class CommandEX {
|
|||||||
} else {
|
} else {
|
||||||
ICommand command = CommandEX.commandList.get(arg[0]);
|
ICommand command = CommandEX.commandList.get(arg[0]);
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
arguments.addAll(command.tab(name, arg, 1));
|
arguments.addAll(command.tab(sender, name, arg, 1));
|
||||||
}
|
}
|
||||||
if (AllMusic.side.checkPermission(name)) {
|
if (AllMusic.side.checkPermission(sender)) {
|
||||||
command = CommandEX.commandAdminList.get(arg[0]);
|
command = CommandEX.commandAdminList.get(arg[0]);
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
arguments.addAll(command.tab(name, arg, 1));
|
arguments.addAll(command.tab(sender, name, arg, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,13 +45,13 @@ public class CommandHud extends ACommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == index + 1) {
|
if (args.length == index + 1) {
|
||||||
return hudlist;
|
return hudlist;
|
||||||
} else {
|
} else {
|
||||||
ICommand command = commandList.get(args[index]);
|
ICommand command = commandList.get(args[index]);
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
return command.tab(name, args, index + 1);
|
return command.tab(player, name, args, index + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
@ -76,7 +76,7 @@ public class CommandHud extends ACommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == index + 1) {
|
if (args.length == index + 1) {
|
||||||
return tf;
|
return tf;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class CommandHudSet extends AHudCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == index + 1) {
|
if (args.length == index + 1) {
|
||||||
List<String> list = new ArrayList<>(hud);
|
List<String> list = new ArrayList<>(hud);
|
||||||
if (type == HudType.PIC) {
|
if (type == HudType.PIC) {
|
||||||
@ -78,7 +78,7 @@ public class CommandHudSet extends AHudCommand {
|
|||||||
} else {
|
} else {
|
||||||
ICommand command = commandList.get(args[index]);
|
ICommand command = commandList.get(args[index]);
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
return command.tab(name, args, index + 1);
|
return command.tab(player, name, args, index + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
@ -104,7 +104,7 @@ public class CommandHudSet extends AHudCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == index + 1) {
|
if (args.length == index + 1) {
|
||||||
return tf;
|
return tf;
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ public class CommandHudSet extends AHudCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == index + 1) {
|
if (args.length == index + 1) {
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ public class CommandHudSet extends AHudCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == index + 1) {
|
if (args.length == index + 1) {
|
||||||
return tf;
|
return tf;
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ public class CommandHudSet extends AHudCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == index + 1) {
|
if (args.length == index + 1) {
|
||||||
return tf;
|
return tf;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ public class CommandPush extends ACommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
List<SongInfoObj> list1 = PlayMusic.getList();
|
List<SongInfoObj> list1 = PlayMusic.getList();
|
||||||
|
@ -38,7 +38,7 @@ public class CommandSelect extends ACommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tab(String name, String[] args, int index) {
|
public List<String> tab(Object player, String name, String[] args, int index) {
|
||||||
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
SearchPageObj obj = AllMusic.getSearch(name);
|
SearchPageObj obj = AllMusic.getSearch(name);
|
||||||
|
@ -6,5 +6,5 @@ public interface ICommand {
|
|||||||
|
|
||||||
void execute(Object sender, String name, String[] args);
|
void execute(Object sender, String name, String[] args);
|
||||||
|
|
||||||
List<String> tab(String name, String[] args, int index);
|
List<String> tab(Object sender, String name, String[] args, int index);
|
||||||
}
|
}
|
||||||
|
@ -471,6 +471,7 @@ public class PlayMusic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void clearIdleList() {
|
public static void clearIdleList() {
|
||||||
|
deep.clear();
|
||||||
playIdleList.clear();
|
playIdleList.clear();
|
||||||
DataSql.clearIdleList();
|
DataSql.clearIdleList();
|
||||||
}
|
}
|
||||||
@ -499,16 +500,16 @@ public class PlayMusic {
|
|||||||
if (size > playIdleList.size() / 2) {
|
if (size > playIdleList.size() / 2) {
|
||||||
size = playIdleList.size() / 2;
|
size = playIdleList.size() / 2;
|
||||||
}
|
}
|
||||||
if (deep.size() >= size) {
|
while (deep.size() >= size) {
|
||||||
deep.poll();
|
deep.poll();
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
id = playIdleList.get(new Random().nextInt(playIdleList.size()));
|
id = playIdleList.get(AllMusic.random.nextInt(playIdleList.size()));
|
||||||
}
|
}
|
||||||
while (deep.contains(id));
|
while (deep.contains(id));
|
||||||
deep.add(id);
|
deep.add(id);
|
||||||
} else {
|
} else {
|
||||||
id = playIdleList.get(new Random().nextInt(playIdleList.size()));
|
id = playIdleList.get(AllMusic.random.nextInt(playIdleList.size()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
id = playIdleList.get(idleNow);
|
id = playIdleList.get(idleNow);
|
||||||
|
@ -32,7 +32,7 @@ public class CommandVelocity implements SimpleCommand {
|
|||||||
if (invocation.source() instanceof Player) {
|
if (invocation.source() instanceof Player) {
|
||||||
Player player = (Player) invocation.source();
|
Player player = (Player) invocation.source();
|
||||||
String name = player.getUsername();
|
String name = player.getUsername();
|
||||||
return CommandEX.getTabList(name, args);
|
return CommandEX.getTabList(player, name, args);
|
||||||
}
|
}
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user