Refactor to core module, part 5

This commit is contained in:
PikaMug 2022-01-20 23:03:40 -05:00
parent 4cfde2b126
commit 25910ac66d
10 changed files with 128 additions and 124 deletions

View File

@ -806,8 +806,8 @@ public class Quests extends JavaPlugin implements QuestsAPI {
loadQuests();
loadActions();
loadConditions();
getLogger().log(Level.INFO, "Loaded " + quests.size() + " Quest(s), " + actions.size() + " IAction(s), "
+ conditions.size() + " ICondition(s) and " + Lang.size() + " Phrase(s)");
getLogger().log(Level.INFO, "Loaded " + quests.size() + " Quest(s), " + actions.size() + " Action(s), "
+ conditions.size() + " Condition(s) and " + Lang.size() + " Phrase(s)");
for (final Player p : getServer().getOnlinePlayers()) {
final IQuester quester = new Quester(Quests.this, p.getUniqueId());
if (!quester.hasData()) {

View File

@ -117,7 +117,7 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
return ChatColor.YELLOW + Lang.get("stageEditorDenizenScript");
}
case 8:
return ChatColor.YELLOW + Lang.get("eventEditorFailQuest") + ":";
return ChatColor.YELLOW + Lang.get("eventEditorFailQuest");
case 9:
return ChatColor.GREEN + Lang.get("save");
case 10:
@ -173,7 +173,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
if (context.getSessionData(CK.E_FAIL_QUEST) == null) {
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
}
return "" + ChatColor.AQUA + context.getSessionData(CK.E_FAIL_QUEST);
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_FAIL_QUEST) + ChatColor.GRAY
+ ")";
default:
return null;
}
@ -377,11 +378,11 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
= new ActionsEditorPostOpenNumericPromptEvent(context, this);
plugin.getServer().getPluginManager().callEvent(event);
final StringBuilder text = new StringBuilder(ChatColor.GOLD + getTitle(context) + "\n");
final StringBuilder text = new StringBuilder(ChatColor.GOLD + getTitle(context));
for (int i = 1; i <= size; i++) {
text.append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i).append(ChatColor.RESET)
.append(" - ").append(getSelectionText(context, i)).append(" ")
.append(getAdditionalText(context, i)).append("\n");
text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i)
.append(ChatColor.RESET).append(" - ").append(getSelectionText(context, i)).append(" ")
.append(getAdditionalText(context, i));
}
return text.toString();
}
@ -499,46 +500,46 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
switch (number) {
case 1:
return "(" + (questMob.getName() == null ? Lang.get("noneSet") : ChatColor.AQUA + questMob.getName())
+ ChatColor.GRAY + ")\n";
+ ChatColor.GRAY + ")";
case 2:
return "(" + (questMob.getType() == null ? Lang.get("noneSet") : ChatColor.AQUA
+ questMob.getType().name()) + ChatColor.GRAY + ")\n";
+ questMob.getType().name()) + ChatColor.GRAY + ")";
case 3:
return "(" + (questMob.getSpawnLocation() == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ ConfigUtil.getLocationInfo(questMob.getSpawnLocation())) + ChatColor.GRAY + ")\n";
+ ConfigUtil.getLocationInfo(questMob.getSpawnLocation())) + ChatColor.GRAY + ")";
case 4:
return "(" + (questMob.getSpawnAmounts() == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getSpawnAmounts()) + ChatColor.GRAY + ")\n";
+ "" + questMob.getSpawnAmounts()) + ChatColor.GRAY + ")";
case 5:
return "(" + (questMob.getInventory()[0] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ ItemUtil.getDisplayString(questMob.getInventory()[0])) + ChatColor.GRAY + ")\n";
+ ItemUtil.getDisplayString(questMob.getInventory()[0])) + ChatColor.GRAY + ")";
case 6:
return "(" + (questMob.getDropChances()[0] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getDropChances()[0]) + ChatColor.GRAY + ")\n";
+ "" + questMob.getDropChances()[0]) + ChatColor.GRAY + ")";
case 7:
return "(" + (questMob.getInventory()[1] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ ItemUtil.getDisplayString(questMob.getInventory()[1])) + ChatColor.GRAY + ")\n";
+ ItemUtil.getDisplayString(questMob.getInventory()[1])) + ChatColor.GRAY + ")";
case 8:
return "(" + (questMob.getDropChances()[1] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getDropChances()[1]) + ChatColor.GRAY + ")\n";
+ "" + questMob.getDropChances()[1]) + ChatColor.GRAY + ")";
case 9:
return "(" + (questMob.getInventory()[2] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ ItemUtil.getDisplayString(questMob.getInventory()[2])) + ChatColor.GRAY + ")\n";
+ ItemUtil.getDisplayString(questMob.getInventory()[2])) + ChatColor.GRAY + ")";
case 10:
return "(" + (questMob.getDropChances()[2] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getDropChances()[2]) + ChatColor.GRAY + ")\n";
+ "" + questMob.getDropChances()[2]) + ChatColor.GRAY + ")";
case 11:
return "(" + (questMob.getInventory()[3] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ ItemUtil.getDisplayString(questMob.getInventory()[3])) + ChatColor.GRAY + ")\n";
+ ItemUtil.getDisplayString(questMob.getInventory()[3])) + ChatColor.GRAY + ")";
case 12:
return "(" + (questMob.getDropChances()[3] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getDropChances()[3]) + ChatColor.GRAY + ")\n";
+ "" + questMob.getDropChances()[3]) + ChatColor.GRAY + ")";
case 13:
return "(" + (questMob.getInventory()[4] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ ItemUtil.getDisplayString(questMob.getInventory()[4])) + ChatColor.GRAY + ")\n";
+ ItemUtil.getDisplayString(questMob.getInventory()[4])) + ChatColor.GRAY + ")";
case 14:
return "(" + (questMob.getDropChances()[4] == null ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA
+ "" + questMob.getDropChances()[4]) + ChatColor.GRAY + ")\n";
+ "" + questMob.getDropChances()[4]) + ChatColor.GRAY + ")";
case 15:
case 16:
return "";
@ -567,9 +568,9 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
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(ChatColor.GRAY).append(" ")
.append(getAdditionalText(context, i));
text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i)
.append(ChatColor.RESET).append(" - ").append(getSelectionText(context, i))
.append(ChatColor.GRAY).append(" ").append(getAdditionalText(context, i));
}
return text.toString();
}
@ -973,10 +974,11 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
context.getPlugin().getServer().getPluginManager().callEvent(event);
}
final StringBuilder text = new StringBuilder(ChatColor.DARK_AQUA + "- " + getTitle(context) + " -\n");
if (plugin.getDependencies().getDenizenApi().getScriptNames() != null) {
final StringBuilder text = new StringBuilder(ChatColor.DARK_AQUA + "- " + getTitle(context) + " -");
if (plugin.getDependencies().getDenizenApi() != null
&& plugin.getDependencies().getDenizenApi().getScriptNames() != null) {
for (final String s : plugin.getDependencies().getDenizenApi().getScriptNames()) {
text.append(ChatColor.AQUA).append("- ").append(s).append("\n");
text.append("\n").append(ChatColor.AQUA).append("- ").append(s);
}
}
return text.toString() + ChatColor.YELLOW + getQueryText(context);
@ -1164,7 +1166,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
final StringBuilder text = new StringBuilder(ChatColor.YELLOW + getQueryText(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));
text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i)
.append(ChatColor.RESET).append(" - ").append(getSelectionText(context, i));
}
return QuestsNumericPrompt.sendClickableSelection(text.toString(), context);
}

View File

@ -93,15 +93,15 @@ public class EffectPrompt extends ActionsEditorNumericPrompt {
if (context.getSessionData(CK.E_EFFECTS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
final LinkedList<String> effects = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS);
final LinkedList<String> locations
= (LinkedList<String>) context.getSessionData(CK.E_EFFECTS_LOCATIONS);
if (effects != null && locations != null) {
for (final String effect : effects) {
text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(effect)
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(effect)
.append(ChatColor.GRAY).append(" at ").append(ChatColor.DARK_AQUA)
.append(locations.get(effects.indexOf(effect))).append("\n");
.append(locations.get(effects.indexOf(effect)));
}
}
return text.toString();
@ -110,11 +110,11 @@ public class EffectPrompt extends ActionsEditorNumericPrompt {
if (context.getSessionData(CK.E_EXPLOSIONS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
final LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_EXPLOSIONS);
if (locations != null) {
for (final String loc : locations) {
text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(loc).append("\n");
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(loc);
}
}
return text.toString();
@ -221,9 +221,9 @@ public class EffectPrompt extends ActionsEditorNumericPrompt {
if (context.getSessionData(CK.E_EFFECTS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
for (final String s : (List<String>) Objects.requireNonNull(context.getSessionData(CK.E_EFFECTS))) {
text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s).append("\n");
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s);
}
return text.toString();
}
@ -231,10 +231,10 @@ public class EffectPrompt extends ActionsEditorNumericPrompt {
if (context.getSessionData(CK.E_EFFECTS_LOCATIONS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
for (final String s : (List<String>) Objects.requireNonNull(context
.getSessionData(CK.E_EFFECTS_LOCATIONS))) {
text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s).append("\n");
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s);
}
return text.toString();
}

View File

@ -89,21 +89,21 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
case 1:
return ChatColor.YELLOW + Lang.get("eventEditorSetMessage");
case 2:
return ChatColor.YELLOW + Lang.get("eventEditorClearInv");
case 3:
return ChatColor.YELLOW + Lang.get("eventEditorSetItems");
case 4:
case 3:
return ChatColor.YELLOW + Lang.get("eventEditorSetPotionEffects");
case 5:
case 4:
return ChatColor.YELLOW + Lang.get("eventEditorSetHunger");
case 6:
case 5:
return ChatColor.YELLOW + Lang.get("eventEditorSetSaturation");
case 7:
case 6:
return ChatColor.YELLOW + Lang.get("eventEditorSetHealth");
case 8:
case 7:
return ChatColor.YELLOW + Lang.get("eventEditorSetTeleport");
case 9:
case 8:
return ChatColor.YELLOW + Lang.get("eventEditorSetCommands");
case 9:
return ChatColor.YELLOW + Lang.get("eventEditorClearInv");
case 10:
return ChatColor.GREEN + Lang.get("done");
default:
@ -122,27 +122,25 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_MESSAGE) + ChatColor.GRAY + ")";
}
case 2:
return ChatColor.AQUA + "" + context.getSessionData(CK.E_CLEAR_INVENTORY);
case 3:
if (context.getSessionData(CK.E_ITEMS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
final LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.E_ITEMS);
if (items != null) {
for (final ItemStack is : items) {
if (is != null) {
text.append(ChatColor.GRAY).append(" - ").append(ItemUtil.getString(is)).append("\n");
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ItemUtil.getString(is));
}
}
return text.toString();
}
}
case 4:
case 3:
if (context.getSessionData(CK.E_POTION_TYPES) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
final LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_POTION_TYPES);
final LinkedList<Long> durations = (LinkedList<Long>) context.getSessionData(CK.E_POTION_DURATIONS);
final LinkedList<Integer> mags = (LinkedList<Integer>) context.getSessionData(CK.E_POTION_STRENGTH);
@ -150,53 +148,56 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
if (types != null && durations != null && mags != null) {
for (final String type : types) {
index++;
text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(type)
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(type)
.append(ChatColor.DARK_PURPLE).append(" ").append(RomanNumeral.getNumeral(mags
.get(index))).append(ChatColor.GRAY).append(" -> ").append(ChatColor.DARK_AQUA)
.append(MiscUtil.getTime(durations.get(index) * 50L)).append("\n");
.append(MiscUtil.getTime(durations.get(index) * 50L));
}
}
return text.toString();
}
case 5:
case 4:
if (context.getSessionData(CK.E_HUNGER) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_HUNGER) + ChatColor.GRAY
+ ")";
}
case 6:
case 5:
if (context.getSessionData(CK.E_SATURATION) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_SATURATION) + ChatColor.GRAY
+ ")";
}
case 7:
case 6:
if (context.getSessionData(CK.E_HEALTH) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_HEALTH) + ChatColor.GRAY
+ ")";
}
case 8:
case 7:
if (context.getSessionData(CK.E_TELEPORT) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_TELEPORT) + ChatColor.GRAY
+ ")";
}
case 9:
case 8:
if (context.getSessionData(CK.E_COMMANDS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
for (final String s : (LinkedList<String>) Objects.requireNonNull(context
.getSessionData(CK.E_COMMANDS))) {
text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s).append("\n");
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s);
}
return text.toString();
}
case 9:
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_CLEAR_INVENTORY) + ChatColor.GRAY
+ ")";
case 10:
return "";
default:
@ -229,26 +230,16 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
case 1:
return new PlayerMessagePrompt(context);
case 2:
final String s = (String) context.getSessionData(CK.E_CLEAR_INVENTORY);
if (s != null) {
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("noWord"));
} else {
context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("yesWord"));
}
}
return new ActionMainPrompt(context);
case 3:
return new PlayerItemListPrompt(context);
case 3:
return new PlayerPotionListPrompt(context);
case 4:
return new PlayerPotionEffectPrompt(context);
case 5:
return new PlayerHungerPrompt(context);
case 6:
case 5:
return new PlayerSaturationPrompt(context);
case 7:
case 6:
return new PlayerHealthPrompt(context);
case 8:
case 7:
if (context.getForWhom() instanceof Player) {
final Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory().getSelectedTeleportLocations();
selectedTeleportLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
@ -258,13 +249,23 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("consoleError"));
return new PlayerPrompt(context);
}
case 9:
case 8:
if (!plugin.hasLimitedAccess(context.getForWhom())) {
return new PlayerCommandsPrompt(context);
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("noPermission"));
return new PlayerPrompt(context);
}
case 9:
final String s = (String) context.getSessionData(CK.E_CLEAR_INVENTORY);
if (s != null) {
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("noWord"));
} else {
context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("yesWord"));
}
}
return new PlayerPrompt(context);
case 10:
return new ActionMainPrompt(context);
default:
@ -364,11 +365,11 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
if (context.getSessionData(CK.E_ITEMS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
for (final ItemStack is : (List<ItemStack>) Objects.requireNonNull(context
.getSessionData(CK.E_ITEMS))) {
text.append(ChatColor.GRAY).append(" - ").append(ItemUtil.getDisplayString(is))
.append("\n");
text.append("\n").append(ChatColor.GRAY).append(" - ")
.append(ItemUtil.getDisplayString(is));
}
return text.toString();
}
@ -430,9 +431,9 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
}
}
public class PlayerPotionEffectPrompt extends ActionsEditorNumericPrompt {
public class PlayerPotionListPrompt extends ActionsEditorNumericPrompt {
public PlayerPotionEffectPrompt(final ConversationContext context) {
public PlayerPotionListPrompt(final ConversationContext context) {
super(context);
}
@ -490,10 +491,10 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
if (context.getSessionData(CK.E_POTION_TYPES) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
for (final String s : (LinkedList<String>) Objects.requireNonNull(context
.getSessionData(CK.E_POTION_TYPES))) {
text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s).append("\n");
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(s);
}
return text.toString();
}
@ -501,11 +502,11 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
if (context.getSessionData(CK.E_POTION_DURATIONS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
for (final Long l : (LinkedList<Long>) Objects.requireNonNull(context
.getSessionData(CK.E_POTION_DURATIONS))) {
text.append(ChatColor.GRAY).append(" - ").append(ChatColor.DARK_AQUA)
.append(MiscUtil.getTime(l * 50L)).append("\n");
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.DARK_AQUA)
.append(MiscUtil.getTime(l * 50L));
}
return text.toString();
}
@ -513,11 +514,11 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
if (context.getSessionData(CK.E_POTION_STRENGTH) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
for (final int i : (LinkedList<Integer>) Objects.requireNonNull(context
.getSessionData(CK.E_POTION_STRENGTH))) {
text.append(ChatColor.GRAY).append(" - ").append(ChatColor.DARK_PURPLE).append(i)
.append("\n");
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.DARK_PURPLE)
.append(i);
}
return text.toString();
}
@ -553,7 +554,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
case 2:
if (context.getSessionData(CK.E_POTION_TYPES) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetPotionTypesFirst"));
return new PlayerPotionEffectPrompt(context);
return new PlayerPotionListPrompt(context);
} else {
return new PlayerPotionDurationsPrompt(context);
}
@ -561,11 +562,11 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
if (context.getSessionData(CK.E_POTION_TYPES) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("eventEditorMustSetPotionTypesAndDurationsFirst"));
return new PlayerPotionEffectPrompt(context);
return new PlayerPotionListPrompt(context);
} else if (context.getSessionData(CK.E_POTION_DURATIONS) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED
+ Lang.get("eventEditorMustSetPotionDurationsFirst"));
return new PlayerPotionEffectPrompt(context);
return new PlayerPotionListPrompt(context);
} else {
return new PlayerPotionMagnitudesPrompt(context);
}
@ -574,7 +575,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
context.setSessionData(CK.E_POTION_TYPES, null);
context.setSessionData(CK.E_POTION_DURATIONS, null);
context.setSessionData(CK.E_POTION_STRENGTH, null);
return new PlayerPotionEffectPrompt(context);
return new PlayerPotionListPrompt(context);
case 5:
final int one;
final int two;
@ -601,10 +602,10 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
return new ActionMainPrompt(context);
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorListSizeMismatch"));
return new PlayerPotionEffectPrompt(context);
return new PlayerPotionListPrompt(context);
}
default:
return new PlayerPotionEffectPrompt(context);
return new PlayerPotionListPrompt(context);
}
}
}
@ -631,9 +632,9 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
= new ActionsEditorPostOpenStringPromptEvent(context, this);
plugin.getServer().getPluginManager().callEvent(event);
final StringBuilder effs = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n");
final StringBuilder effs = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context));
for (final PotionEffectType pet : PotionEffectType.values()) {
effs.append(pet != null ? ChatColor.DARK_PURPLE + pet.getName() + "\n" : "");
effs.append(pet != null ? "\n" + ChatColor.DARK_PURPLE + pet.getName() : "");
}
return effs.toString() + ChatColor.YELLOW + getQueryText(context);
}
@ -656,7 +657,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
}
}
}
return new PlayerPotionEffectPrompt(context);
return new PlayerPotionListPrompt(context);
}
}
@ -710,7 +711,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
}
context.setSessionData(CK.E_POTION_DURATIONS, effDurations);
}
return new PlayerPotionEffectPrompt(context);
return new PlayerPotionListPrompt(context);
}
}
@ -763,7 +764,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
}
context.setSessionData(CK.E_POTION_STRENGTH, magAmounts);
}
return new PlayerPotionEffectPrompt(context);
return new PlayerPotionListPrompt(context);
}
}

View File

@ -67,7 +67,7 @@ public class TimerPrompt extends ActionsEditorNumericPrompt {
case 1:
return ChatColor.YELLOW + Lang.get("eventEditorSetTimer");
case 2:
return ChatColor.YELLOW + Lang.get("eventEditorCancelTimer") + ":";
return ChatColor.YELLOW + Lang.get("eventEditorCancelTimer");
case 3:
return ChatColor.GREEN + Lang.get("done");
default:
@ -89,7 +89,8 @@ public class TimerPrompt extends ActionsEditorNumericPrompt {
}
}
case 2:
return ChatColor.AQUA + "" + context.getSessionData(CK.E_CANCEL_TIMER);
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.E_CANCEL_TIMER) + ChatColor.GRAY
+ ")";
case 3:
return "";
default:

View File

@ -117,11 +117,11 @@ public class WeatherPrompt extends ActionsEditorNumericPrompt {
if (context.getSessionData(CK.E_LIGHTNING) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
final LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_LIGHTNING);
if (locations != null) {
for (final String loc : locations) {
text.append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(loc).append("\n");
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA).append(loc);
}
}
return text.toString();
@ -315,10 +315,10 @@ public class WeatherPrompt extends ActionsEditorNumericPrompt {
= new ActionsEditorPostOpenStringPromptEvent(context, this);
plugin.getServer().getPluginManager().callEvent(event);
StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n"
StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context)
+ ChatColor.DARK_PURPLE);
for (final World w : plugin.getServer().getWorlds()) {
effects.append(w.getName()).append(", ");
effects.append("\n").append(w.getName()).append(", ");
}
effects = new StringBuilder(effects.substring(0, effects.length()));
return ChatColor.YELLOW + effects.toString() + getQueryText(context);
@ -532,10 +532,10 @@ public class WeatherPrompt extends ActionsEditorNumericPrompt {
= new ActionsEditorPostOpenStringPromptEvent(context, this);
plugin.getServer().getPluginManager().callEvent(event);
StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n"
StringBuilder effects = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context)
+ ChatColor.DARK_PURPLE);
for (final World w : plugin.getServer().getWorlds()) {
effects.append(w.getName()).append(", ");
effects.append("\n").append(w.getName()).append(", ");
}
effects = new StringBuilder(effects.substring(0, effects.length()));
return ChatColor.YELLOW + effects.toString() + getQueryText(context);

View File

@ -333,11 +333,11 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
context.getPlugin().getServer().getPluginManager().callEvent(event);
}
final StringBuilder text = new StringBuilder(ChatColor.AQUA + getTitle(context) + "\n");
final StringBuilder text = new StringBuilder(ChatColor.AQUA + getTitle(context));
for (int i = 1; i <= size; i++) {
text.append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i).append(ChatColor.RESET)
.append(" - ").append(getSelectionText(context, i)).append(" ")
.append(getAdditionalText(context, i)).append("\n");
text.append("\n").append(getNumberColor(context, i)).append(ChatColor.BOLD).append(i)
.append(ChatColor.RESET).append(" - ").append(getSelectionText(context, i)).append(" ")
.append(getAdditionalText(context, i));
}
return text.toString();
}

View File

@ -266,8 +266,7 @@ public class EntityPrompt extends QuestsEditorNumericPrompt {
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
selectingNpcs.add(((Player) context.getForWhom()).getUniqueId());
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
return ChatColor.YELLOW + getQueryText(context) + "\n"
+ ChatColor.GOLD + Lang.get("npcHint");
return ChatColor.YELLOW + getQueryText(context) + "\n" + ChatColor.GOLD + Lang.get("npcHint");
} else {
return ChatColor.YELLOW + getQueryText(context);
}

View File

@ -263,13 +263,13 @@ public class PlayerPrompt extends QuestsEditorNumericPrompt {
if (context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
final StringBuilder text = new StringBuilder("\n");
final StringBuilder text = new StringBuilder();
final List<ItemStack> whileHoldingMainHand
= (List<ItemStack>) context.getSessionData(CK.C_WHILE_HOLDING_MAIN_HAND);
if (whileHoldingMainHand != null) {
for (final ItemStack is : whileHoldingMainHand) {
text.append(ChatColor.GRAY).append(" - ").append(ItemUtil.getDisplayString(is))
.append("\n");
text.append("\n").append(ChatColor.GRAY).append(" - ")
.append(ItemUtil.getDisplayString(is));
}
}
return text.toString();