1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

Add jobfullname variable to tab completions

This commit is contained in:
montlikadani 2021-05-22 19:15:02 +02:00
parent 96379db923
commit 5f5e1f7113
2 changed files with 24 additions and 7 deletions

View File

@ -407,8 +407,8 @@ public class LanguageManager {
Jobs.getGCManager().getCommandArgs().put("playerinfo", Arrays.asList("[playername]", "[jobname]", "[action]"));
c.get("command.join.help.info", "Join the selected job.");
c.get("command.join.help.args", "[jobname]");
Jobs.getGCManager().getCommandArgs().put("join", Arrays.asList("[jobname]"));
c.get("command.join.help.args", "[jobfullname]");
Jobs.getGCManager().getCommandArgs().put("join", Arrays.asList("[jobfullname]"));
c.get("command.join.error.alreadyin", "You are already in the job %jobname%.");
c.get("command.join.error.fullslots", "You cannot join the job %jobname%, there are no slots available.");
c.get("command.join.error.maxjobs", "You have already joined too many jobs.");

View File

@ -33,6 +33,7 @@ public class TabComplete implements TabCompleter {
for (int i = 1; i <= args.length; i++) {
if (args.length == i + 1) {
List<String> argsList = Jobs.getGCManager().getCommandArgs().get(first);
if (argsList == null)
break;
@ -50,6 +51,7 @@ public class TabComplete implements TabCompleter {
t2.add(arg);
List<String> temp = new ArrayList<>();
for (String ar : t2) {
switch (ar) {
case "[scheduleName]":
@ -61,17 +63,26 @@ public class TabComplete implements TabCompleter {
case "[questname]":
case "[quest]":
Job job = Jobs.getJob(args[i - 1]);
if (job != null) {
for (Quest q : job.getQuests()) {
temp.add(q.getQuestName());
}
}
break;
case "[jobname]":
case "[newjob]":
for (Job one : Jobs.getJobs()) {
temp.add(one.getName());
}
break;
case "[jobfullname]":
for (Job one : Jobs.getJobs()) {
temp.add(one.getJobFullName());
}
break;
case "[playername]":
for (Player player : Bukkit.getOnlinePlayers()) {
@ -93,33 +104,39 @@ public class TabComplete implements TabCompleter {
for (JobItems one : ItemBoostManager.getItems().values()) {
temp.add(one.getNode());
}
if (args.length > 3 && args[3].equalsIgnoreCase("limiteditems")) {
Job oneJob = Jobs.getJob(args[i - 1]);
if (oneJob != null)
for (JobLimitedItems limitedItem : oneJob.getLimitedItems().values()) {
temp.add(limitedItem.getNode());
}
}
break;
case "[boosteditems]":
for (JobItems one : ItemBoostManager.getItems().values()) {
temp.add(one.getNode());
}
break;
case "[oldjob]":
JobsPlayer onePlayerJob = Jobs.getPlayerManager().getJobsPlayer(args[i - 1]);
if (onePlayerJob != null)
for (JobProgression oneOldJob : onePlayerJob.getJobProgression()) {
temp.add(oneOldJob.getJob().getName());
}
break;
case "[oldplayerjob]":
if (sender instanceof Player) {
if ((onePlayerJob = Jobs.getPlayerManager().getJobsPlayer((Player) sender)) != null)
for (JobProgression oneOldJob : onePlayerJob.getJobProgression()) {
temp.add(oneOldJob.getJob().getName());
}
if (sender instanceof Player && (onePlayerJob = Jobs.getPlayerManager().getJobsPlayer((Player) sender)) != null) {
for (JobProgression oneOldJob : onePlayerJob.getJobProgression()) {
temp.add(oneOldJob.getJob().getName());
}
}
break;
default:
temp.add(ar);