Remove color on quest tab complete, fixes #1907

This commit is contained in:
PikaMug 2022-03-24 01:28:51 -04:00
parent 0c699b2de8
commit 637ac02ee2
8 changed files with 36 additions and 7 deletions

View File

@ -4332,6 +4332,14 @@ public class Quests extends JavaPlugin implements QuestsAPI {
return q; return q;
} }
} }
for (final IQuest iq : quests) {
// For tab completion
final Quest q = (Quest) iq;
if (ChatColor.stripColor(q.getName()).equals(ChatColor.stripColor(ChatColor
.translateAlternateColorCodes('&', name)))) {
return q;
}
}
return null; return null;
} }
@ -4360,6 +4368,13 @@ public class Quests extends JavaPlugin implements QuestsAPI {
return q; return q;
} }
} }
for (final IQuest q : quests) {
// For tab completion
if (ChatColor.stripColor(q.getName()).equals(ChatColor.stripColor(ChatColor
.translateAlternateColorCodes('&', name)))) {
return q;
}
}
return null; return null;
} }
@ -4388,6 +4403,13 @@ public class Quests extends JavaPlugin implements QuestsAPI {
return a; return a;
} }
} }
for (final IAction a : actions) {
// For tab completion
if (ChatColor.stripColor(a.getName()).equals(ChatColor.stripColor(ChatColor.
translateAlternateColorCodes('&', name)))) {
return a;
}
}
return null; return null;
} }
@ -4416,6 +4438,13 @@ public class Quests extends JavaPlugin implements QuestsAPI {
return c; return c;
} }
} }
for (final ICondition c : conditions) {
// For tab completion
if (ChatColor.stripColor(c.getName()).equals(ChatColor.stripColor(ChatColor
.translateAlternateColorCodes('&', name)))) {
return c;
}
}
return null; return null;
} }

View File

@ -116,7 +116,7 @@ public class QuestadminFinishCommand extends QuestsSubCommand {
final List<String> results = new ArrayList<>(); final List<String> results = new ArrayList<>();
for (final IQuest quest : plugin.getLoadedQuests()) { for (final IQuest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) { if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(quest.getName()); results.add(ChatColor.stripColor(quest.getName()));
} }
} }
return results; return results;

View File

@ -135,7 +135,7 @@ public class QuestadminGiveCommand extends QuestsSubCommand {
final List<String> results = new ArrayList<>(); final List<String> results = new ArrayList<>();
for (final IQuest quest : plugin.getLoadedQuests()) { for (final IQuest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) { if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(quest.getName()); results.add(ChatColor.stripColor(quest.getName()));
} }
} }
return results; return results;

View File

@ -116,7 +116,7 @@ public class QuestadminNextstageCommand extends QuestsSubCommand {
final List<String> results = new ArrayList<>(); final List<String> results = new ArrayList<>();
for (final IQuest quest : plugin.getLoadedQuests()) { for (final IQuest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) { if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(quest.getName()); results.add(ChatColor.stripColor(quest.getName()));
} }
} }
return results; return results;

View File

@ -111,7 +111,7 @@ public class QuestadminQuitCommand extends QuestsSubCommand {
final List<String> results = new ArrayList<>(); final List<String> results = new ArrayList<>();
for (final IQuest quest : plugin.getLoadedQuests()) { for (final IQuest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) { if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(quest.getName()); results.add(ChatColor.stripColor(quest.getName()));
} }
} }
return results; return results;

View File

@ -108,7 +108,7 @@ public class QuestadminRemoveCommand extends QuestsSubCommand {
final List<String> results = new ArrayList<>(); final List<String> results = new ArrayList<>();
for (final IQuest quest : plugin.getLoadedQuests()) { for (final IQuest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) { if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(quest.getName()); results.add(ChatColor.stripColor(quest.getName()));
} }
} }
return results; return results;

View File

@ -102,7 +102,7 @@ public class QuestsQuitCommand extends QuestsSubCommand {
final List<String> results = new ArrayList<>(); final List<String> results = new ArrayList<>();
for (final IQuest quest : plugin.getLoadedQuests()) { for (final IQuest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[1].toLowerCase())) { if (quest.getName().toLowerCase().startsWith(args[1].toLowerCase())) {
results.add(quest.getName()); results.add(ChatColor.stripColor(quest.getName()));
} }
} }
return results; return results;

View File

@ -102,7 +102,7 @@ public class QuestsTakeCommand extends QuestsSubCommand {
final List<String> results = new ArrayList<>(); final List<String> results = new ArrayList<>();
for (final IQuest quest : plugin.getLoadedQuests()) { for (final IQuest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[1].toLowerCase())) { if (quest.getName().toLowerCase().startsWith(args[1].toLowerCase())) {
results.add(quest.getName()); results.add(ChatColor.stripColor(quest.getName()));
} }
} }
return results; return results;