1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-30 21:07:48 +01:00

Restore copying tab completion keys

This commit is contained in:
montlikadani 2021-06-10 12:23:05 +02:00
parent b55af27db2
commit efd1c91386

View File

@ -8,6 +8,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.gamingmesh.jobs.ItemBoostManager;
import com.gamingmesh.jobs.Jobs;
@ -19,15 +20,15 @@ import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.Quest;
public class TabComplete implements TabCompleter {
public final class TabComplete implements TabCompleter {
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
if (args.length == 1) {
return new ArrayList<>(Jobs.getCommandManager().getCommands(sender));
}
List<String> completionList = new ArrayList<>();
if (args.length > 1) {
if (args.length == 1) {
StringUtil.copyPartialMatches(args[0], Jobs.getCommandManager().getCommands(sender), completionList);
} else if (args.length > 1) {
String first = args[0].toLowerCase();
for (int i = 1; i <= args.length; i++) {
@ -43,8 +44,9 @@ public class TabComplete implements TabCompleter {
String arg = argsList.get(i - 1);
List<String> t2 = new ArrayList<>();
if (arg.contains("%%"))
for (String one : arg.split("%%")) {
String[] split = arg.split("%%");
if (split.length > 0)
for (String one : split) {
t2.add(one);
}
else
@ -144,11 +146,12 @@ public class TabComplete implements TabCompleter {
}
}
return temp;
StringUtil.copyPartialMatches(args[i], temp, completionList);
}
}
}
return null;
java.util.Collections.sort(completionList);
return completionList;
}
}