Cleanup action list prompts

This commit is contained in:
PikaMug 2022-03-31 08:08:49 -04:00
parent d363d6d81c
commit 81f7fb4d3c
4 changed files with 41 additions and 34 deletions

View File

@ -25,6 +25,7 @@ import me.blackvein.quests.util.MiscUtil;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
@ -180,7 +181,7 @@ public class EffectPrompt extends ActionsEditorNumericPrompt {
@Override
public String getTitle(final ConversationContext context) {
return Lang.get("eventEditorEffects");
return Lang.get("eventEditorEffectsTitle");
}
@Override
public ChatColor getNumberColor(final ConversationContext context, final int number) {
@ -252,7 +253,7 @@ public class EffectPrompt extends ActionsEditorNumericPrompt {
= new ActionsEditorPostOpenNumericPromptEvent(context, this);
plugin.getServer().getPluginManager().callEvent(event);
final StringBuilder text = new StringBuilder(ChatColor.GOLD + "- " + getTitle(context) + " -");
final StringBuilder text = new StringBuilder(ChatColor.GOLD + getTitle(context));
for (int i = 1; i <= size; i++) {
text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i)
.append(ChatColor.RESET).append(" - ").append(getSelectionText(context, i)).append(" ")
@ -337,17 +338,15 @@ public class EffectPrompt extends ActionsEditorNumericPrompt {
plugin.getServer().getPluginManager().callEvent(event);
final StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n");
final Effect[] values = Effect.values();
for (int i = 0; i < values.length; i++) {
final Effect eff = values[i];
if (i < (values.length - 1)) {
effects.append(MiscUtil.snakeCaseToUpperCamelCase(eff.name())).append(", ");
} else {
effects.append(MiscUtil.snakeCaseToUpperCamelCase(eff.name())).append("\n");
final Effect[] worldArr = Effect.values();
for (int i = 0; i < worldArr.length; i++) {
effects.append(ChatColor.AQUA).append(MiscUtil.snakeCaseToUpperCamelCase(worldArr[i].name()));
if (i < (worldArr.length - 1)) {
effects.append(ChatColor.GRAY).append(", ");
}
}
return effects.toString() + ChatColor.YELLOW + getQueryText(context);
effects.append("\n").append(ChatColor.YELLOW).append(getQueryText(context));
return effects.toString();
}
@SuppressWarnings("unchecked")

View File

@ -27,6 +27,7 @@ import me.blackvein.quests.util.MiscUtil;
import me.blackvein.quests.util.RomanNumeral;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
@ -631,12 +632,17 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
final ActionsEditorPostOpenStringPromptEvent event
= new ActionsEditorPostOpenStringPromptEvent(context, this);
plugin.getServer().getPluginManager().callEvent(event);
final StringBuilder effs = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context));
for (final PotionEffectType pet : PotionEffectType.values()) {
effs.append(pet != null ? "\n" + ChatColor.DARK_PURPLE + pet.getName() : "");
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)) {
potions.append(ChatColor.GRAY).append(", ");
}
}
return effs.toString() + ChatColor.YELLOW + getQueryText(context);
potions.append("\n").append(ChatColor.YELLOW).append(getQueryText(context));
return potions.toString();
}
@Override

View File

@ -32,6 +32,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
@ -315,13 +316,16 @@ public class WeatherPrompt extends ActionsEditorNumericPrompt {
= new ActionsEditorPostOpenStringPromptEvent(context, this);
plugin.getServer().getPluginManager().callEvent(event);
StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context)
+ ChatColor.DARK_PURPLE);
for (final World w : plugin.getServer().getWorlds()) {
effects.append("\n").append(w.getName()).append(", ");
final StringBuilder worlds = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n");
final List<World> worldArr = plugin.getServer().getWorlds();
for (int i = 0; i < worldArr.size(); i++) {
worlds.append(ChatColor.AQUA).append(worldArr.get(i).getName());
if (i < (worldArr.size() - 1)) {
worlds.append(ChatColor.GRAY).append(", ");
}
}
effects = new StringBuilder(effects.substring(0, effects.length()));
return effects + "\n" + ChatColor.YELLOW + getQueryText(context);
worlds.append("\n").append(ChatColor.YELLOW).append(getQueryText(context));
return worlds.toString();
}
@Override
@ -531,14 +535,17 @@ public class WeatherPrompt extends ActionsEditorNumericPrompt {
final ActionsEditorPostOpenStringPromptEvent event
= new ActionsEditorPostOpenStringPromptEvent(context, this);
plugin.getServer().getPluginManager().callEvent(event);
StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context)
+ ChatColor.DARK_PURPLE);
for (final World w : plugin.getServer().getWorlds()) {
effects.append("\n").append(w.getName()).append(", ");
final StringBuilder worlds = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n");
final List<World> worldArr = plugin.getServer().getWorlds();
for (int i = 0; i < worldArr.size(); i++) {
worlds.append(ChatColor.AQUA).append(worldArr.get(i).getName());
if (i < (worldArr.size() - 1)) {
worlds.append(ChatColor.GRAY).append(", ");
}
}
effects = new StringBuilder(effects.substring(0, effects.length()));
return ChatColor.YELLOW + effects.toString() + getQueryText(context);
worlds.append("\n").append(ChatColor.YELLOW).append(getQueryText(context));
return worlds.toString();
}
@Override

View File

@ -318,7 +318,6 @@ eventEditorSetItemAmounts: "Set item amounts"
eventEditorNoNames: "No names set"
eventEditorMustSetNames: "You must set item names first!"
eventEditorInvalidName: "is not a valid item name!"
eventEditorStorm: "Action Storm"
eventEditorSetWorld: "Set world"
eventEditorSetDuration: "Set duration"
eventEditorSetWorldFirst: "You must set a world first!"
@ -327,18 +326,15 @@ eventEditorMustSetStormDuration: "You must set a storm duration!"
eventEditorStormCleared: "Storm data cleared."
eventEditorEnterStormWorld: "Enter a world name for the storm to occur in, <cancel>"
eventEditorEnterDuration: "Enter duration (in seconds)"
eventEditorThunder: "Action Thunder"
eventEditorMustSetThunderDuration: "You must set a thunder duration!"
eventEditorThunderCleared: "Thunder data cleared."
eventEditorEnterThunderWorld: "Enter a world name for the thunder to occur in, <cancel>"
eventEditorEffects: "Action Sound Effects"
eventEditorAddEffect: "Add sound effect"
eventEditorAddEffectLocation: "Add sound effect location"
eventEditorMustAddEffects: "You must add sound effects first!"
eventEditorInvalidEffect: "is not a valid sound effect name!"
eventEditorEffectsCleared: "Action sound effects cleared."
eventEditorEffectLocationPrompt: "Right-click on a block to play a sound effect at, <add>, <cancel>"
eventEditorMobSpawns: "Action Mob Spawns"
eventEditorAddMobTypes: "Add mob"
eventEditorSetMobName: "Set custom name for mob"
eventEditorSetMobType: "Set mob type"
@ -361,7 +357,6 @@ eventEditorSetMobChestPlateDrop: "Set drop chance of chest plate"
eventEditorSetMobHelmet: "Set helmet"
eventEditorSetMobHelmetDrop: "Set drop chance of helmet"
eventEditorSetDropChance: "Enter drop chance between <least> and <greatest>, <cancel>"
eventEditorPotionEffects: "Action Potion Effects"
eventEditorSetPotionEffectTypes: "Set potion effect types"
eventEditorMustSetPotionTypesFirst: "You must set potion effect types first!"
eventEditorSetPotionDurations: "Set potion effect durations"