mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
Restore copying tab completion keys
This commit is contained in:
parent
b55af27db2
commit
efd1c91386
@ -8,6 +8,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.StringUtil;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.ItemBoostManager;
|
import com.gamingmesh.jobs.ItemBoostManager;
|
||||||
import com.gamingmesh.jobs.Jobs;
|
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.JobsPlayer;
|
||||||
import com.gamingmesh.jobs.container.Quest;
|
import com.gamingmesh.jobs.container.Quest;
|
||||||
|
|
||||||
public class TabComplete implements TabCompleter {
|
public final class TabComplete implements TabCompleter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (args.length == 1) {
|
List<String> completionList = new ArrayList<>();
|
||||||
return new ArrayList<>(Jobs.getCommandManager().getCommands(sender));
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
String first = args[0].toLowerCase();
|
||||||
|
|
||||||
for (int i = 1; i <= args.length; i++) {
|
for (int i = 1; i <= args.length; i++) {
|
||||||
@ -43,8 +44,9 @@ public class TabComplete implements TabCompleter {
|
|||||||
String arg = argsList.get(i - 1);
|
String arg = argsList.get(i - 1);
|
||||||
List<String> t2 = new ArrayList<>();
|
List<String> t2 = new ArrayList<>();
|
||||||
|
|
||||||
if (arg.contains("%%"))
|
String[] split = arg.split("%%");
|
||||||
for (String one : arg.split("%%")) {
|
if (split.length > 0)
|
||||||
|
for (String one : split) {
|
||||||
t2.add(one);
|
t2.add(one);
|
||||||
}
|
}
|
||||||
else
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user