mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-23 19:15:49 +01:00
Save proper Action effect name, fixes #1199
This commit is contained in:
parent
6e5ebdba93
commit
0d7e282807
@ -493,15 +493,17 @@ public class Action {
|
||||
List<String> effectList = data.getStringList(actionKey + "effects");
|
||||
List<String> effectLocs = data.getStringList(actionKey + "effect-locations");
|
||||
for (String s : effectList) {
|
||||
Effect effect = Effect.valueOf(s.toUpperCase());
|
||||
Location l = ConfigUtil.getLocation(effectLocs.get(effectList.indexOf(s)));
|
||||
if (effect == null) {
|
||||
Effect effect = null;
|
||||
try {
|
||||
effect = Effect.valueOf(s.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s
|
||||
+ ChatColor.GOLD + " inside " + ChatColor.GREEN + "effects: " + ChatColor.GOLD
|
||||
+ "inside Action " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD
|
||||
+ " is not a valid effect name!");
|
||||
return null;
|
||||
}
|
||||
Location l = ConfigUtil.getLocation(effectLocs.get(effectList.indexOf(s)));
|
||||
if (l == null) {
|
||||
plugin.getLogger().severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED
|
||||
+ effectLocs.get(effectList.indexOf(s)) + ChatColor.GOLD + " inside "
|
||||
|
@ -1599,6 +1599,52 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
}
|
||||
|
||||
private class SoundEffectPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String effects = ChatColor.LIGHT_PURPLE + Lang.get("eventEditorEffectsTitle") + "\n";
|
||||
Effect[] vals = Effect.values();
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
Effect eff = vals[i];
|
||||
if (i < (vals.length - 1)) {
|
||||
effects += MiscUtil.snakeCaseToUpperCamelCase(eff.name()) + ", ";
|
||||
} else {
|
||||
effects += MiscUtil.snakeCaseToUpperCamelCase(eff.name()) + "\n";
|
||||
}
|
||||
|
||||
}
|
||||
return effects + ChatColor.YELLOW + Lang.get("effEnterName");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
if (getProperEffect(input) != null) {
|
||||
LinkedList<String> effects;
|
||||
if (context.getSessionData(CK.E_EFFECTS) != null) {
|
||||
effects = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS);
|
||||
} else {
|
||||
effects = new LinkedList<String>();
|
||||
}
|
||||
effects.add(getProperEffect(input).name());
|
||||
context.setSessionData(CK.E_EFFECTS, effects);
|
||||
selectedEffectLocations.remove(player.getUniqueId());
|
||||
return new SoundEffectListPrompt();
|
||||
} else {
|
||||
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
|
||||
+ Lang.get("eventEditorInvalidEffect"));
|
||||
return new SoundEffectPrompt();
|
||||
}
|
||||
} else {
|
||||
selectedEffectLocations.remove(player.getUniqueId());
|
||||
return new SoundEffectListPrompt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SoundEffectLocationPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
@ -1637,52 +1683,6 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
}
|
||||
|
||||
private class SoundEffectPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String effects = ChatColor.LIGHT_PURPLE + Lang.get("eventEditorEffectsTitle") + "\n";
|
||||
Effect[] vals = Effect.values();
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
Effect eff = vals[i];
|
||||
if (i < (vals.length - 1)) {
|
||||
effects += MiscUtil.snakeCaseToUpperCamelCase(eff.name()) + ", ";
|
||||
} else {
|
||||
effects += MiscUtil.snakeCaseToUpperCamelCase(eff.name()) + "\n";
|
||||
}
|
||||
|
||||
}
|
||||
return effects + ChatColor.YELLOW + Lang.get("effEnterName");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
if (getProperEffect(input) != null) {
|
||||
LinkedList<String> effects;
|
||||
if (context.getSessionData(CK.E_EFFECTS) != null) {
|
||||
effects = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS);
|
||||
} else {
|
||||
effects = new LinkedList<String>();
|
||||
}
|
||||
effects.add(input.toUpperCase());
|
||||
context.setSessionData(CK.E_EFFECTS, effects);
|
||||
selectedEffectLocations.remove(player.getUniqueId());
|
||||
return new SoundEffectListPrompt();
|
||||
} else {
|
||||
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
|
||||
+ Lang.get("eventEditorInvalidEffect"));
|
||||
return new SoundEffectPrompt();
|
||||
}
|
||||
} else {
|
||||
selectedEffectLocations.remove(player.getUniqueId());
|
||||
return new SoundEffectListPrompt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class StormPrompt extends FixedSetPrompt {
|
||||
|
||||
public StormPrompt() {
|
||||
|
Loading…
Reference in New Issue
Block a user