Reduce duplicates for Crowdin. Bump version number

This commit is contained in:
HappyPikachu 2018-05-10 16:38:06 -04:00
parent eb5998a179
commit da5170182d
8 changed files with 238 additions and 189 deletions

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId>
<version>3.3.2</version>
<version>3.3.3</version>
<name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging>

View File

@ -52,7 +52,6 @@ import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang;
import me.blackvein.quests.util.MiscUtil;
import me.blackvein.quests.util.QuestMob;
import net.citizensnpcs.api.CitizensAPI;
public class EventFactory implements ConversationAbandonedListener {
@ -935,27 +934,6 @@ public class EventFactory implements ConversationAbandonedListener {
}
}
@SuppressWarnings("unused")
private class SetNpcStartPrompt extends NumericPrompt {
@Override
public String getPromptText(ConversationContext context) {
return ChatColor.YELLOW + Lang.get("eventEditorEnterNPCId");
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() != -1) {
if (CitizensAPI.getNPCRegistry().getById(input.intValue()) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorNoNPCExists"));
return new SetNpcStartPrompt();
}
context.setSessionData("npcStart", input.intValue());
}
return new CreateMenuPrompt();
}
}
private class ExplosionPrompt extends StringPrompt {
@Override
@ -2080,7 +2058,7 @@ public class EventFactory implements ConversationAbandonedListener {
}
}
private class HungerPrompt extends NumericPrompt {
private class HungerPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
@ -2088,13 +2066,20 @@ public class EventFactory implements ConversationAbandonedListener {
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() != -1) {
if (input.intValue() < 0) {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i < 0) {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
return new HungerPrompt();
} else {
context.setSessionData(CK.E_HUNGER, (Integer) i);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new HungerPrompt();
} else {
context.setSessionData(CK.E_HUNGER, (Integer) input.intValue());
}
} else {
context.setSessionData(CK.E_HUNGER, null);
@ -2103,7 +2088,7 @@ public class EventFactory implements ConversationAbandonedListener {
}
}
private class SaturationPrompt extends NumericPrompt {
private class SaturationPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
@ -2111,13 +2096,20 @@ public class EventFactory implements ConversationAbandonedListener {
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() != -1) {
if (input.intValue() < 0) {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i < 0) {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
return new SaturationPrompt();
} else {
context.setSessionData(CK.E_SATURATION, (Integer) i);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new SaturationPrompt();
} else {
context.setSessionData(CK.E_SATURATION, (Integer) input.intValue());
}
} else {
context.setSessionData(CK.E_SATURATION, null);
@ -2126,7 +2118,7 @@ public class EventFactory implements ConversationAbandonedListener {
}
}
private class HealthPrompt extends NumericPrompt {
private class HealthPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
@ -2134,13 +2126,20 @@ public class EventFactory implements ConversationAbandonedListener {
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() != -1) {
if (input.intValue() < 0) {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i < 0) {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
return new HealthPrompt();
} else {
context.setSessionData(CK.E_HEALTH, (Integer) i);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new HealthPrompt();
} else {
context.setSessionData(CK.E_HEALTH, (Integer) input.intValue());
}
} else {
context.setSessionData(CK.E_HEALTH, null);

View File

@ -37,7 +37,6 @@ import org.bukkit.conversations.ConversationAbandonedListener;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.conversations.FixedSetPrompt;
import org.bukkit.conversations.NumericPrompt;
import org.bukkit.conversations.Prompt;
import org.bukkit.conversations.StringPrompt;
import org.bukkit.enchantments.Enchantment;
@ -324,7 +323,7 @@ public class QuestFactory implements ConversationAbandonedListener {
}
}
private class SetNpcStartPrompt extends NumericPrompt {
private class SetNpcStartPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
@ -333,26 +332,29 @@ public class QuestFactory implements ConversationAbandonedListener {
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() > -1) {
if (CitizensAPI.getNPCRegistry().getById(input.intValue()) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC"));
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > -1) {
if (CitizensAPI.getNPCRegistry().getById(i) == null) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC"));
return new SetNpcStartPrompt();
}
context.setSessionData(CK.Q_START_NPC, i);
selectingNPCs.remove((Player) context.getForWhom());
return new CreateMenuPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new SetNpcStartPrompt();
}
context.setSessionData(CK.Q_START_NPC, input.intValue());
selectingNPCs.remove((Player) context.getForWhom());
return new CreateMenuPrompt();
} else if (input.intValue() == -1) {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.Q_START_NPC, null);
selectingNPCs.remove((Player) context.getForWhom());
return new CreateMenuPrompt();
} else if (input.intValue() == -2) {
selectingNPCs.remove((Player) context.getForWhom());
return new CreateMenuPrompt();
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC"));
return new SetNpcStartPrompt();
}
selectingNPCs.remove((Player) context.getForWhom());
return new CreateMenuPrompt();
}
}

View File

@ -25,7 +25,6 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.FixedSetPrompt;
import org.bukkit.conversations.NumericPrompt;
import org.bukkit.conversations.Prompt;
import org.bukkit.conversations.StringPrompt;
import org.bukkit.enchantments.Enchantment;
@ -759,7 +758,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new BreakBlockNamesPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNotListofNumbers") + "\n" + ChatColor.LIGHT_PURPLE + s);
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new BreakBlockNamesPrompt();
}
}
@ -790,7 +789,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new BreakBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new BreakBlockAmountsPrompt();
}
}
@ -821,7 +820,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new BreakBlockDurabilityPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new BreakBlockDurabilityPrompt();
}
}
@ -977,7 +976,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new DamageBlockNamesPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new DamageBlockNamesPrompt();
}
}
@ -1008,7 +1007,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new DamageBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new DamageBlockAmountsPrompt();
}
}
@ -1039,7 +1038,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new DamageBlockDurabilityPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new DamageBlockDurabilityPrompt();
}
}
@ -1195,7 +1194,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new PlaceBlockNamesPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new PlaceBlockNamesPrompt();
}
}
@ -1226,7 +1225,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new PlaceBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new PlaceBlockAmountsPrompt();
}
}
@ -1257,7 +1256,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new PlaceBlockDurabilityPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new PlaceBlockDurabilityPrompt();
}
}
@ -1413,7 +1412,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new UseBlockNamesPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new UseBlockNamesPrompt();
}
}
@ -1444,7 +1443,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new UseBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new UseBlockAmountsPrompt();
}
}
@ -1475,7 +1474,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new UseBlockDurabilityPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new UseBlockDurabilityPrompt();
}
}
@ -1631,7 +1630,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new CutBlockNamesPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new CutBlockNamesPrompt();
}
}
@ -1662,7 +1661,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new CutBlockAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new CutBlockAmountsPrompt();
}
}
@ -1693,7 +1692,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new CutBlockDurabilityPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new CutBlockDurabilityPrompt();
}
}
@ -1703,7 +1702,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
}
}
private class FishPrompt extends NumericPrompt {
private class FishPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
@ -1711,22 +1710,29 @@ public class CreateStagePrompt extends FixedSetPrompt {
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number number) {
int num = number.intValue();
Player player = (Player) context.getForWhom();
if (num < -1) {
player.sendMessage(ChatColor.RED + Lang.get("stageEditorPositiveAmount"));
return new FishPrompt();
} else if (num == 0) {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i < 0) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorPositiveAmount"));
return new FishPrompt();
} else if (i > 0) {
context.setSessionData(pref + CK.S_FISH, i);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new FishPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_FISH, null);
} else if (num > 0) {
context.setSessionData(pref + CK.S_FISH, num);
}
return new CreateStagePrompt(stageNum, questFactory, citizens);
}
}
private class KillPlayerPrompt extends NumericPrompt {
private class KillPlayerPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
@ -1734,16 +1740,23 @@ public class CreateStagePrompt extends FixedSetPrompt {
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number number) {
int num = number.intValue();
Player player = (Player) context.getForWhom();
if (num < -1) {
player.sendMessage(ChatColor.RED + Lang.get("stageEditorPositiveAmount"));
return new KillPlayerPrompt();
} else if (num == 0) {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i < 0) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorPositiveAmount"));
return new FishPrompt();
} else if (i > 0) {
context.setSessionData(pref + CK.S_PLAYER_KILL, i);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new FishPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_PLAYER_KILL, null);
} else if (num > 0) {
context.setSessionData(pref + CK.S_PLAYER_KILL, num);
}
return new CreateStagePrompt(stageNum, questFactory, citizens);
}
@ -1936,7 +1949,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new EnchantItemsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new EnchantItemsPrompt();
}
}
@ -1967,7 +1980,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new EnchantAmountsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new EnchantAmountsPrompt();
}
}
@ -2126,7 +2139,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new DeliveryNPCsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new DeliveryNPCsPrompt();
}
}
@ -2180,7 +2193,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new NPCIDsToTalkToPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new NPCIDsToTalkToPrompt();
}
}
@ -2300,7 +2313,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new NpcIdsToKillPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new NpcIdsToKillPrompt();
}
}
@ -2332,7 +2345,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new NpcAmountsToKillPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorNotListofNumbers"));
return new NpcAmountsToKillPrompt();
}
}
@ -3640,7 +3653,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
int i = Integer.parseInt(input);
stageDelay = i * 1000;
} catch (NumberFormatException e) {
player.sendMessage(ChatColor.RED + Lang.get("stageEditorNoNumber"));
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("stageEditorInvalidNumber"));
return new DelayPrompt();
}
if (stageDelay < 1000) {
@ -3907,7 +3920,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
return new CreateStagePrompt(stageNum, questFactory, citizens);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoNumber"));
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED + Lang.get("stageEditorInvalidNumber"));
return new CustomObjectiveCountPrompt();
}
}

View File

@ -113,18 +113,16 @@ public class PlannerPrompt extends FixedSetPrompt {
try {
int i = Integer.parseInt(input);
delay = i * 1000;
if (delay < 1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
} else {
context.setSessionData(CK.PLN_REPEAT_CYCLE, delay);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " "
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new RepeatPrompt();
}
if (delay < -1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
} else if (delay == 0) {
context.setSessionData(CK.PLN_REPEAT_CYCLE, null);
} else if (delay != -1) {
context.setSessionData(CK.PLN_REPEAT_CYCLE, delay);
}
return new PlannerPrompt(quests, factory);
}
}
@ -148,18 +146,16 @@ public class PlannerPrompt extends FixedSetPrompt {
try {
int i = Integer.parseInt(input);
delay = i * 1000;
if (delay < 1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
} else {
context.setSessionData(CK.PLN_COOLDOWN, delay);
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.ITALIC + "" + ChatColor.RED + input + ChatColor.RESET + ChatColor.RED + " "
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new CooldownPrompt();
}
if (delay < -1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorPositiveAmount"));
} else if (delay == 0) {
context.setSessionData(CK.PLN_COOLDOWN, null);
} else if (delay != -1) {
context.setSessionData(CK.PLN_COOLDOWN, delay);
}
return new PlannerPrompt(quests, factory);
}
}

View File

@ -22,7 +22,6 @@ import java.util.Map;
import org.bukkit.ChatColor;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.FixedSetPrompt;
import org.bukkit.conversations.NumericPrompt;
import org.bukkit.conversations.Prompt;
import org.bukkit.conversations.StringPrompt;
import org.bukkit.inventory.ItemStack;
@ -187,7 +186,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
return null;
}
private class MoneyPrompt extends NumericPrompt {
private class MoneyPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
@ -201,40 +200,56 @@ public class RequirementsPrompt extends FixedSetPrompt {
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqGreaterThanZero"));
return new MoneyPrompt();
} else if (input.intValue() == -1) {
return new RequirementsPrompt(quests, factory);
} else if (input.intValue() == 0) {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > 0) {
context.setSessionData(CK.REQ_MONEY, i);
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("inputPosNum"));
return new MoneyPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new MoneyPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.REQ_MONEY, null);
return new RequirementsPrompt(quests, factory);
}
context.setSessionData(CK.REQ_MONEY, input.intValue());
return new RequirementsPrompt(quests, factory);
}
}
private class QuestPointsPrompt extends NumericPrompt {
private class QuestPointsPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
return ChatColor.YELLOW + Lang.get("reqQuestPointsPrompt");
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "0"));
return new QuestPointsPrompt();
} else if (input.intValue() == -1) {
return new RequirementsPrompt(quests, factory);
} else if (input.intValue() == 0) {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > 0) {
context.setSessionData(CK.REQ_QUEST_POINTS, i);
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("inputPosNum"));
return new QuestPointsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new QuestPointsPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.REQ_QUEST_POINTS, null);
return new RequirementsPrompt(quests, factory);
}
context.setSessionData(CK.REQ_QUEST_POINTS, input.intValue());
return new RequirementsPrompt(quests, factory);
}
}

View File

@ -21,7 +21,6 @@ import java.util.Map;
import org.bukkit.ChatColor;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.FixedSetPrompt;
import org.bukkit.conversations.NumericPrompt;
import org.bukkit.conversations.Prompt;
import org.bukkit.conversations.StringPrompt;
import org.bukkit.inventory.ItemStack;
@ -186,7 +185,7 @@ public class RewardsPrompt extends FixedSetPrompt {
return null;
}
private class MoneyPrompt extends NumericPrompt {
private class MoneyPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
@ -199,58 +198,88 @@ public class RewardsPrompt extends FixedSetPrompt {
}
return ChatColor.YELLOW + text;
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("inputPosNum"));
return new MoneyPrompt();
} else if (input.intValue() == 0) {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > 0) {
context.setSessionData(CK.REW_MONEY, i);
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("inputPosNum"));
return new MoneyPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new MoneyPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.REW_MONEY, null);
} else if (input.intValue() != -1) {
context.setSessionData(CK.REW_MONEY, input.intValue());
return new RewardsPrompt(quests, factory);
}
return new RewardsPrompt(quests, factory);
}
}
private class ExperiencePrompt extends NumericPrompt {
private class ExperiencePrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
return ChatColor.YELLOW + Lang.get("rewExperiencePrompt");
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("inputPosNum"));
return new ExperiencePrompt();
} else if (input.intValue() == -1) {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > 0) {
context.setSessionData(CK.REW_EXP, i);
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("inputPosNum"));
return new ExperiencePrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new ExperiencePrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.REW_EXP, null);
} else if (input.intValue() != 0) {
context.setSessionData(CK.REW_EXP, input.intValue());
return new RewardsPrompt(quests, factory);
}
return new RewardsPrompt(quests, factory);
}
}
private class QuestPointsPrompt extends NumericPrompt {
private class QuestPointsPrompt extends StringPrompt {
@Override
public String getPromptText(ConversationContext context) {
return ChatColor.YELLOW + Lang.get("rewQuestPointsPrompt");
}
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("inputPosNum"));
return new QuestPointsPrompt();
} else if (input.intValue() == -1) {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
int i = Integer.parseInt(input);
if (i > 0) {
context.setSessionData(CK.REW_QUEST_POINTS, i);
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("inputPosNum"));
return new QuestPointsPrompt();
}
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
+ Lang.get("stageEditorInvalidNumber"));
return new QuestPointsPrompt();
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.REW_QUEST_POINTS, null);
} else if (input.intValue() != 0) {
context.setSessionData(CK.REW_QUEST_POINTS, input.intValue());
return new RewardsPrompt(quests, factory);
}
return new RewardsPrompt(quests, factory);
}

View File

@ -69,7 +69,7 @@ questEditorEnterQuestName: "Enter Quest name (<cancel>)"
questEditorEditEnterQuestName: "Enter Quest name to edit (<cancel>)"
questEditorEnterAskMessage: "Enter ask message (<cancel>)"
questEditorEnterFinishMessage: "Enter finish message (<cancel>)"
questEditorEnterNPCStart: "Enter NPC ID, -1 to clear the NPC start or -2 to cancel"
questEditorEnterNPCStart: "Enter NPC ID, <clear>, <cancel>"
questEditorEnterBlockStart: "Right-click on a block to use as a start point, <done>, <clear>, <cancel>"
questEditorEnterInitialEvent: "Enter an Event name, <clear>, <cancel>"
questRequiredNoneSet: "Required, none set"
@ -192,8 +192,8 @@ stageEditorPlaceBlocksPrompt: "Enter place amounts (numbers), <space>, <cancel>"
stageEditorUseBlocksPrompt: "Enter use amounts (numbers), <space>, <cancel>"
stageEditorCutBlocksPrompt: "Enter cut amounts (numbers), <space>, <cancel>"
stageEditorEnterBlockDurability: "Enter block durability (numbers), <space>, <cancel>"
stageEditorCatchFishPrompt: "Enter number of fish to catch, or 0 to clear the fish catch objective, or -1 to cancel"
stageEditorKillPlayerPrompt: "Enter number of players to kill, or 0 to clear the player kill objective, or -1 to cancel"
stageEditorCatchFishPrompt: "Enter number of fish to catch, <clear>, <cancel>"
stageEditorKillPlayerPrompt: "Enter number of players to kill, <clear>, <cancel>"
stageEditorEnchantTypePrompt: "Enter enchantment names, <semicolon>, <cancel>"
stageEditorEnchantAmountsPrompt: "Enter enchant amounts (numbers), <space>, <cancel>"
stageEditorItemNamesPrompt: "Enter item names, <space>, <cancel>"
@ -246,8 +246,7 @@ stageEditorInvalidScript: "Denizen script not found!"
stageEditorNoCitizens: "Citizens is not installed!"
stageEditorNoDenizen: "Denizen is not installed!"
stageEditorPositiveAmount: "You must enter a positive number!"
stageEditorNoNumber: "Input was not a number!"
stageEditorNotListofNumbers: "Invalid entry, input was not a list of numbers!"
stageEditorNotListofNumbers: "is not a list of numbers!"
stageEditorNoDelaySet: "You must set a delay first!"
stageEditorNoBlockNames: "You must set block names first!"
stageEditorNoEnchantments: "You must set enchantments first!"
@ -422,8 +421,6 @@ eventEditorNoDurationsSet: "(No durations set)"
eventEditorSetPotionMagnitudes: "Set potion effect magnitudes"
eventEditorPotionsCleared: "Potion effects cleared."
eventEditorInvalidPotionType: "is not a valid potion effect type!"
eventEditorEnterNPCId: "Enter NPC ID (or -1 to cancel)"
eventEditorNoNPCExists: "No NPC exists with that id!"
eventEditorLightningPrompt: "Right-click on a block to spawn a lightning strike at, <add>, <clear>, <cancel>"
eventEditorExplosionPrompt: "Right-click on a block to spawn an explosion at, <add>, <clear>, <cancel>"
eventEditorSelectBlockFirst: "You must select a block first."
@ -435,9 +432,9 @@ eventEditorSetMobLocationPrompt: "Right-click on a block to select it, <add>, <c
eventEditorSetPotionEffectsPrompt: "Enter potion effect types, <space>, <cancel>"
eventEditorSetPotionDurationsPrompt: "Enter potion effect durations (in seconds), <space>, <cancel>"
eventEditorSetPotionMagnitudesPrompt: "Enter potion effect magnitudes, <space>, <cancel>"
eventEditorSetHungerPrompt: "Enter hunger level, or -1 to clear"
eventEditorSetSaturationPrompt: "Enter saturation level, or -1 to clear"
eventEditorSetHealthPrompt: "Enter health level, or -1 to clear"
eventEditorSetHungerPrompt: "Enter hunger level, <clear>"
eventEditorSetSaturationPrompt: "Enter saturation level, <clear>"
eventEditorSetHealthPrompt: "Enter health level, <clear>"
eventEditorSetTeleportPrompt: "Right-click on a block to teleport the player to, <done>, <clear>, <cancel>"
eventEditorCommandsNote: "Note: You may use <player> to refer to the player's name."
eventEditorSetCommandsPrompt: "Enter commands, <semicolon>, <clear>, <cancel>"
@ -455,8 +452,8 @@ reqSetSkills: "Set skills"
reqSetSkillAmounts: "Set skill amounts"
reqHeroesSetPrimary: "Set Primary Class"
reqHeroesSetSecondary: "Set Secondary Class"
reqMoneyPrompt: "Enter amount of <money>, or 0 to clear the money requirement, or -1 to cancel"
reqQuestPointsPrompt: "Enter amount of Quest Points, or 0 to clear the Quest Point requirement, or -1 to cancel"
reqMoneyPrompt: "Enter amount of <money>, <clear>, <cancel>"
reqQuestPointsPrompt: "Enter amount of Quest Points, <clear>, <cancel>"
reqQuestListTitle: "- Quests Available -"
reqQuestPrompt: "Enter a list of Quest names, <semicolon>, <clear>, <cancel>"
reqRemoveItemsPrompt: "Enter a list of true/false values, <space>, <cancel>"
@ -498,10 +495,8 @@ plnStart: "Set start date"
plnEnd: "Set end date"
plnRepeat: "Set repeat cycle"
plnCooldown: "Set player cooldown"
plnStartPrompt: "Enter amount of time (in seconds), 0 to clear the start date or -1 to cancel"
plnEndPrompt: "Enter amount of time (in seconds), 0 to clear the end date or -1 to cancel"
plnRepeatPrompt: "Enter amount of time (in seconds), 0 to clear the repeat or -1 to cancel"
plnCooldownPrompt: "Enter amount of time (in seconds), 0 to clear the cooldown or -1 to cancel"
plnRepeatPrompt: "Enter amount of time (in seconds), <clear>, <cancel>"
plnCooldownPrompt: "Enter amount of time (in seconds), <clear>, <cancel>"
plnTooEarly: "<quest> will be active in <time>."
plnTooLate: "<quest> was last active <time> ago."
rewSetMoney: "Set money reward"
@ -516,12 +511,12 @@ rewSetPhat: "Set PhatLoot rewards"
rewSetCustom: "Set custom rewards"
rewSetHeroesClasses: "Set classes"
rewSetHeroesAmounts: "Set experience amounts"
rewMoneyPrompt: "Enter amount of <money>, or 0 to clear the money reward, or -1 to cancel"
rewExperiencePrompt: "Enter amount of experience, or 0 to clear the experience reward, or -1 to cancel"
rewMoneyPrompt: "Enter amount of <money>, <clear>, <cancel>"
rewExperiencePrompt: "Enter amount of experience, <clear>, <cancel>"
rewCommandPrompt: "Enter command rewards, <semicolon>, <clear>, <cancel>"
rewCommandPromptHint: 'Note: You may put <player> to specify the player who completed the Quest. e.g. smite <player>'
rewPermissionsPrompt: "Enter permission rewards, <space>, <clear>, <cancel>"
rewQuestPointsPrompt: "Enter amount of Quest Points, or 0 to clear the Quest Point reward, or -1 to cancel"
rewQuestPointsPrompt: "Enter amount of Quest Points, <clear>, <cancel>"
rewMcMMOPrompt: "Enter mcMMO skills, <space>, <cancel>"
rewMcMMOPromptHint: "Note: Typing 'All' will give levels to all skills."
rewHeroesClassesPrompt: "Enter Heroes classes, <space>, <cancel>"