[1.0.1] pref: update tab complete

This commit is contained in:
thehrz 2025-03-15 09:59:15 +08:00
parent 219f43243d
commit 5311716574
Signed by: thehrz
GPG Key ID: C84CBCE7D5F88855
13 changed files with 28 additions and 29 deletions

View File

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

View File

@ -5,7 +5,7 @@ import java.util.List;
public abstract class ACommand implements ICommand {
@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();
}
}

View File

@ -25,7 +25,7 @@ public class CommandBan extends ACommand {
}
@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())) {
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(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())) {
return AllMusic.side.getPlayerList();
}

View File

@ -50,7 +50,7 @@ public class CommandCancel implements ICommand {
}
@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())) {
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(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())) {
List<String> list = new ArrayList<>();
for (int a = 0; a < PlayMusic.getListSize(); a++) {

View File

@ -153,8 +153,7 @@ 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);
@ -263,11 +262,11 @@ public class CommandEX {
* @param arg 参数
* @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<>();
if (arg.length == 0) {
arguments.addAll(normal);
if (AllMusic.side.checkPermission(name)) {
if (AllMusic.side.checkPermission(sender)) {
arguments.addAll(admin);
}
if (AllMusic.getSearch(name) != null) {
@ -276,7 +275,7 @@ public class CommandEX {
} else {
if (arg[0] == null || arg[0].isEmpty() || arg.length == 1) {
arguments.addAll(normal);
if (AllMusic.side.checkPermission(name)) {
if (AllMusic.side.checkPermission(sender)) {
arguments.addAll(admin);
}
if (arg[0] == null || arg[0].isEmpty()) {
@ -287,12 +286,12 @@ public class CommandEX {
} else {
ICommand command = CommandEX.commandList.get(arg[0]);
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]);
if (command != null) {
arguments.addAll(command.tab(name, arg, 1));
arguments.addAll(command.tab(sender, name, arg, 1));
}
}
}

View File

@ -45,13 +45,13 @@ public class CommandHud extends ACommand {
}
@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) {
return hudlist;
} else {
ICommand command = commandList.get(args[index]);
if (command != null) {
return command.tab(name, args, index + 1);
return command.tab(player, name, args, index + 1);
}
}
return Collections.emptyList();
@ -76,7 +76,7 @@ public class CommandHud extends ACommand {
}
@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) {
return tf;
}

View File

@ -65,7 +65,7 @@ public class CommandHudSet extends AHudCommand {
}
@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) {
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(name, args, index + 1);
return command.tab(player, name, args, index + 1);
}
}
return Collections.emptyList();
@ -104,7 +104,7 @@ public class CommandHudSet extends AHudCommand {
}
@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) {
return tf;
}
@ -181,7 +181,7 @@ public class CommandHudSet extends AHudCommand {
}
@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) {
return dir;
}
@ -229,7 +229,7 @@ public class CommandHudSet extends AHudCommand {
}
@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) {
return tf;
}
@ -263,7 +263,7 @@ public class CommandHudSet extends AHudCommand {
}
@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) {
return tf;
}

View File

@ -95,7 +95,7 @@ public class CommandPush extends ACommand {
}
@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())) {
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(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())) {
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(String name, String[] args, int index);
List<String> tab(Object sender, String name, String[] args, int index);
}

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(name, args);
return CommandEX.getTabList(player, name, args);
}
return ImmutableList.of();
}