mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
Sort action prompt arrays
This commit is contained in:
parent
0ad1d161cc
commit
9ae2bc57da
@ -42,6 +42,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@ -842,14 +844,18 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
final StringBuilder mobs = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n");
|
||||
final EntityType[] mobArr = EntityType.values();
|
||||
for (int i = 0; i < mobArr.length; i++) {
|
||||
final EntityType type = mobArr[i];
|
||||
if (!type.isAlive()) {
|
||||
continue;
|
||||
final List<EntityType> mobArr = new LinkedList<>(Arrays.asList(EntityType.values()));
|
||||
final List<EntityType> toRemove = new LinkedList<>();
|
||||
for (final EntityType type : mobArr) {
|
||||
if (!type.isAlive() || type.name().equals("PLAYER")) {
|
||||
toRemove.add(type);
|
||||
}
|
||||
mobs.append(ChatColor.AQUA).append(BukkitMiscUtil.snakeCaseToUpperCamelCase(mobArr[i].name()));
|
||||
if (i < (mobArr.length - 1)) {
|
||||
}
|
||||
mobArr.removeAll(toRemove);
|
||||
mobArr.sort(Comparator.comparing(EntityType::name));
|
||||
for (int i = 0; i < mobArr.size(); i++) {
|
||||
mobs.append(ChatColor.AQUA).append(BukkitMiscUtil.snakeCaseToUpperCamelCase(mobArr.get(i).name()));
|
||||
if (i < (mobArr.size() - 1)) {
|
||||
mobs.append(ChatColor.GRAY).append(", ");
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -340,10 +342,11 @@ public class ActionEffectPrompt extends ActionsEditorNumericPrompt {
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
final StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n");
|
||||
final Effect[] worldArr = Effect.values();
|
||||
for (int i = 0; i < worldArr.length; i++) {
|
||||
effects.append(ChatColor.AQUA).append(BukkitMiscUtil.snakeCaseToUpperCamelCase(worldArr[i].name()));
|
||||
if (i < (worldArr.length - 1)) {
|
||||
final List<Effect> effArr = new LinkedList<>(Arrays.asList(Effect.values()));
|
||||
effArr.sort(Comparator.comparing(Effect::name));
|
||||
for (int i = 0; i < effArr.size(); i++) {
|
||||
effects.append(ChatColor.AQUA).append(BukkitMiscUtil.snakeCaseToUpperCamelCase(effArr.get(i).name()));
|
||||
if (i < (effArr.size() - 1)) {
|
||||
effects.append(ChatColor.GRAY).append(", ");
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -637,10 +638,12 @@ public class ActionPlayerPrompt extends ActionsEditorNumericPrompt {
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
final StringBuilder potions = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n");
|
||||
final PotionEffectType[] potionArr = PotionEffectType.values();
|
||||
for (int i = 0; i < potionArr.length; i++) {
|
||||
potions.append(ChatColor.AQUA).append(potionArr[i].getName());
|
||||
if (i < (potionArr.length - 1)) {
|
||||
final List<PotionEffectType> effArr = new LinkedList<>(Arrays.asList(PotionEffectType.values()));
|
||||
effArr.sort(Comparator.comparing(PotionEffectType::getName));
|
||||
for (int i = 0; i < effArr.size(); i++) {
|
||||
final String name = effArr.get(i).getName().replaceFirst("minecraft:", "").toUpperCase();
|
||||
potions.append(ChatColor.AQUA).append(name);
|
||||
if (i < (effArr.size() - 1)) {
|
||||
potions.append(ChatColor.GRAY).append(", ");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user