Compare commits

..

No commits in common. "531171657479cc76763b113c7d2a634ef8f85154" and "eecc3178b1881291bcef6e808aafd9c5180f9622" have entirely different histories.

15 changed files with 32 additions and 33 deletions

View File

@ -5,7 +5,7 @@ plugins {
}
group = "io.github.thehrz.allmusicreload"
version = "1.0.1"
version = "1.0.0"
repositories {
mavenCentral()

View File

@ -24,7 +24,6 @@ import java.util.*;
public class AllMusic {
public static final Gson gson = new Gson();
public static final Random random = new Random();
/**
* 客户端插件信道名

View File

@ -5,7 +5,7 @@ import java.util.List;
public abstract class ACommand implements ICommand {
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
return Collections.emptyList();
}
}

View File

@ -25,7 +25,7 @@ public class CommandBan extends ACommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
if (args.length == index || (args.length == index + 1 && args[index].isEmpty())) {
List<String> list = new ArrayList<>();
if (PlayMusic.nowPlayMusic != null) {

View File

@ -18,7 +18,7 @@ public class CommandBanPlayer implements ICommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
if (args.length == index || (args.length == index + 1 && args[index].isEmpty())) {
return AllMusic.side.getPlayerList();
}

View File

@ -50,7 +50,7 @@ public class CommandCancel implements ICommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
List<String> list = new ArrayList<>();
List<SongInfoObj> list1 = PlayMusic.getList();

View File

@ -33,7 +33,7 @@ public class CommandDelete extends ACommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
List<String> list = new ArrayList<>();
for (int a = 0; a < PlayMusic.getListSize(); a++) {

View File

@ -153,11 +153,12 @@ public class CommandEX {
if (args[0].contains("id=") && !args[0].contains("/?userid")) {
if (args[0].contains("&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");
else
musicID = Function.getString(args[0], "id=", null);
} else if (args[0].contains("song/")) {
} else if (args[0].contains("song/")) {
if (args[0].contains("/?userid"))
musicID = Function.getString(args[0], "song/", "/?userid");
else
@ -212,7 +213,7 @@ public class CommandEX {
return true;
}
}
return false;
return false;
}
/**
@ -262,11 +263,11 @@ public class CommandEX {
* @param arg 参数
* @return 指令列表
*/
public static List<String> getTabList(Object sender, String name, String[] arg) {
public static List<String> getTabList(String name, String[] arg) {
List<String> arguments = new ArrayList<>();
if (arg.length == 0) {
arguments.addAll(normal);
if (AllMusic.side.checkPermission(sender)) {
if (AllMusic.side.checkPermission(name)) {
arguments.addAll(admin);
}
if (AllMusic.getSearch(name) != null) {
@ -275,7 +276,7 @@ public class CommandEX {
} else {
if (arg[0] == null || arg[0].isEmpty() || arg.length == 1) {
arguments.addAll(normal);
if (AllMusic.side.checkPermission(sender)) {
if (AllMusic.side.checkPermission(name)) {
arguments.addAll(admin);
}
if (arg[0] == null || arg[0].isEmpty()) {
@ -286,12 +287,12 @@ public class CommandEX {
} else {
ICommand command = CommandEX.commandList.get(arg[0]);
if (command != null) {
arguments.addAll(command.tab(sender, name, arg, 1));
arguments.addAll(command.tab(name, arg, 1));
}
if (AllMusic.side.checkPermission(sender)) {
if (AllMusic.side.checkPermission(name)) {
command = CommandEX.commandAdminList.get(arg[0]);
if (command != null) {
arguments.addAll(command.tab(sender, name, arg, 1));
arguments.addAll(command.tab(name, arg, 1));
}
}
}

View File

@ -45,13 +45,13 @@ public class CommandHud extends ACommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
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(player, name, args, index + 1);
return command.tab(name, args, index + 1);
}
}
return Collections.emptyList();
@ -76,7 +76,7 @@ public class CommandHud extends ACommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
if (args.length == index + 1) {
return tf;
}

View File

@ -65,7 +65,7 @@ public class CommandHudSet extends AHudCommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
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) {
@ -78,7 +78,7 @@ public class CommandHudSet extends AHudCommand {
} else {
ICommand command = commandList.get(args[index]);
if (command != null) {
return command.tab(player, name, args, index + 1);
return command.tab(name, args, index + 1);
}
}
return Collections.emptyList();
@ -104,7 +104,7 @@ public class CommandHudSet extends AHudCommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
if (args.length == index + 1) {
return tf;
}
@ -181,7 +181,7 @@ public class CommandHudSet extends AHudCommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
if (args.length == index + 1) {
return dir;
}
@ -229,7 +229,7 @@ public class CommandHudSet extends AHudCommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
if (args.length == index + 1) {
return tf;
}
@ -263,7 +263,7 @@ public class CommandHudSet extends AHudCommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
if (args.length == index + 1) {
return tf;
}

View File

@ -95,7 +95,7 @@ public class CommandPush extends ACommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
List<String> list = new ArrayList<>();
List<SongInfoObj> list1 = PlayMusic.getList();

View File

@ -38,7 +38,7 @@ public class CommandSelect extends ACommand {
}
@Override
public List<String> tab(Object player, String name, String[] args, int index) {
public List<String> tab(String name, String[] args, int index) {
if (args.length == 1 || (args.length == 2 && args[1].isEmpty())) {
List<String> list = new ArrayList<>();
SearchPageObj obj = AllMusic.getSearch(name);

View File

@ -6,5 +6,5 @@ public interface ICommand {
void execute(Object sender, String name, String[] args);
List<String> tab(Object sender, String name, String[] args, int index);
List<String> tab(String name, String[] args, int index);
}

View File

@ -471,7 +471,6 @@ public class PlayMusic {
}
public static void clearIdleList() {
deep.clear();
playIdleList.clear();
DataSql.clearIdleList();
}
@ -500,16 +499,16 @@ public class PlayMusic {
if (size > playIdleList.size() / 2) {
size = playIdleList.size() / 2;
}
while (deep.size() >= size) {
if (deep.size() >= size) {
deep.poll();
}
do {
id = playIdleList.get(AllMusic.random.nextInt(playIdleList.size()));
id = playIdleList.get(new Random().nextInt(playIdleList.size()));
}
while (deep.contains(id));
deep.add(id);
} else {
id = playIdleList.get(AllMusic.random.nextInt(playIdleList.size()));
id = playIdleList.get(new Random().nextInt(playIdleList.size()));
}
} else {
id = playIdleList.get(idleNow);

View File

@ -32,7 +32,7 @@ public class CommandVelocity implements SimpleCommand {
if (invocation.source() instanceof Player) {
Player player = (Player) invocation.source();
String name = player.getUsername();
return CommandEX.getTabList(player, name, args);
return CommandEX.getTabList(name, args);
}
return ImmutableList.of();
}