Add tab complete for debug command

This commit is contained in:
GeorgH93 2023-07-23 22:05:07 +02:00
parent 8bbbc39d18
commit a430846dfe
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
1 changed files with 14 additions and 0 deletions

View File

@ -49,7 +49,9 @@ import lombok.SneakyThrows;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
public class DebugCommand extends MinepacksCommand
@ -202,6 +204,18 @@ public class DebugCommand extends MinepacksCommand
@Override
public List<String> tabComplete(@NotNull CommandSender commandSender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
{
if (args.length == 1)
{
List<String> completeList = new ArrayList<>(2);
if ("size".startsWith(args[0])) { completeList.add("size"); }
if ("system".startsWith(args[0])) { completeList.add("system"); }
if ("permissions".startsWith(args[0])) { completeList.add("permissions"); }
return completeList;
}
else if (args.length == 2)
{
return Utils.getPlayerNamesStartingWith(args[args.length - 1], null);
}
return null;
}