Display objects of editor delete prompts alphabetically

This commit is contained in:
PikaMug 2021-03-03 06:26:07 -05:00
parent 5cfff53215
commit 223918ee77
3 changed files with 27 additions and 12 deletions

View File

@ -14,6 +14,7 @@ package me.blackvein.quests.convo.actions.menu;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -285,11 +286,15 @@ public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
plugin.getServer().getPluginManager().callEvent(event); plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.GOLD + getTitle(context) + "\n"; String text = ChatColor.GOLD + getTitle(context) + "\n";
for (final Action a : plugin.getActions()) { final List<String> names = plugin.getActions().stream().map(Action::getName).collect(Collectors.toList());
text += ChatColor.AQUA + a.getName() + ChatColor.GRAY + ","; for (int i = 0; i < names.size(); i++) {
if (i < (names.size() - 1)) {
text += ChatColor.AQUA + names.get(i) + ChatColor.GRAY + ", ";
} else {
text += ChatColor.AQUA + names.get(i);
}
} }
text = text.substring(0, text.length() - 1) + "\n"; text += "\n" + ChatColor.YELLOW + getQueryText(context);
text += ChatColor.YELLOW + getQueryText(context);
return text; return text;
} }

View File

@ -14,6 +14,7 @@ package me.blackvein.quests.convo.conditions.menu;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -283,11 +284,15 @@ public class ConditionMenuPrompt extends ConditionsEditorNumericPrompt {
plugin.getServer().getPluginManager().callEvent(event); plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.GOLD + getTitle(context) + "\n"; String text = ChatColor.GOLD + getTitle(context) + "\n";
for (final Condition c : plugin.getConditions()) { final List<String> names = plugin.getConditions().stream().map(Condition::getName).collect(Collectors.toList());
text += ChatColor.AQUA + c.getName() + ChatColor.GRAY + ","; for (int i = 0; i < names.size(); i++) {
if (i < (names.size() - 1)) {
text += ChatColor.AQUA + names.get(i) + ChatColor.GRAY + ", ";
} else {
text += ChatColor.AQUA + names.get(i);
}
} }
text = text.substring(0, text.length() - 1) + "\n"; text += "\n" + ChatColor.YELLOW + getQueryText(context);
text += ChatColor.YELLOW + getQueryText(context);
return text; return text;
} }

View File

@ -14,6 +14,7 @@ package me.blackvein.quests.convo.quests.menu;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -264,11 +265,15 @@ public class QuestMenuPrompt extends QuestsEditorNumericPrompt {
plugin.getServer().getPluginManager().callEvent(event); plugin.getServer().getPluginManager().callEvent(event);
String text = ChatColor.GOLD + getTitle(context) + "\n"; String text = ChatColor.GOLD + getTitle(context) + "\n";
for (final Quest quest : plugin.getQuests()) { final List<String> names = plugin.getQuests().stream().map(Quest::getName).collect(Collectors.toList());
text += ChatColor.AQUA + quest.getName() + ChatColor.GRAY + ","; for (int i = 0; i < names.size(); i++) {
if (i < (names.size() - 1)) {
text += ChatColor.AQUA + names.get(i) + ChatColor.GRAY + ", ";
} else {
text += ChatColor.AQUA + names.get(i);
}
} }
text = text.substring(0, text.length() - 1) + "\n"; text += "\n" + ChatColor.YELLOW + getQueryText(context);
text += ChatColor.YELLOW + getQueryText(context);
return text; return text;
} }