mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-25 03:55:35 +01:00
Prevent exception from stage Action via console
This commit is contained in:
parent
67a72d31c6
commit
b38ee19dab
@ -933,8 +933,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final @NotNull ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||||
final LinkedList<Integer> radii = new LinkedList<>();
|
final LinkedList<Integer> radii = new LinkedList<>();
|
||||||
for (final String s : input.split(" ")) {
|
for (final String s : input.split(" ")) {
|
||||||
@ -947,7 +946,8 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
radii.add(i);
|
radii.add(i);
|
||||||
} catch (final NumberFormatException e) {
|
} catch (final NumberFormatException e) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||||
|
.replace("<input>", input));
|
||||||
return new ReachRadiiPrompt(context);
|
return new ReachRadiiPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1465,8 +1465,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final @NotNull ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
||||||
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
IAction found = null;
|
IAction found = null;
|
||||||
@ -1477,7 +1476,8 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found == null) {
|
if (found == null) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent").replace("<input>", input));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent")
|
||||||
|
.replace("<input>", input));
|
||||||
return new StartActionPrompt(context);
|
return new StartActionPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.setSessionData(stagePrefix + CK.S_START_EVENT, found.getName());
|
context.setSessionData(stagePrefix + CK.S_START_EVENT, found.getName());
|
||||||
@ -1487,7 +1487,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_START_EVENT, null);
|
context.setSessionData(stagePrefix + CK.S_START_EVENT, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorEventCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorEventCleared"));
|
||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new StartActionPrompt(context);
|
return new StartActionPrompt(context);
|
||||||
@ -1531,8 +1531,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final @NotNull ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
||||||
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
IAction found = null;
|
IAction found = null;
|
||||||
@ -1543,7 +1542,8 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found == null) {
|
if (found == null) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent").replace("<input>", input));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent")
|
||||||
|
.replace("<input>", input));
|
||||||
return new FinishActionPrompt(context);
|
return new FinishActionPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.setSessionData(stagePrefix + CK.S_FINISH_EVENT, found.getName());
|
context.setSessionData(stagePrefix + CK.S_FINISH_EVENT, found.getName());
|
||||||
@ -1553,7 +1553,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_FINISH_EVENT, null);
|
context.setSessionData(stagePrefix + CK.S_FINISH_EVENT, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorEventCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorEventCleared"));
|
||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new FinishActionPrompt(context);
|
return new FinishActionPrompt(context);
|
||||||
@ -1597,8 +1597,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final @NotNull ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
||||||
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
IAction found = null;
|
IAction found = null;
|
||||||
@ -1609,7 +1608,8 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found == null) {
|
if (found == null) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent").replace("<input>", input));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent")
|
||||||
|
.replace("<input>", input));
|
||||||
return new FailActionPrompt(context);
|
return new FailActionPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.setSessionData(stagePrefix + CK.S_FAIL_EVENT, found.getName());
|
context.setSessionData(stagePrefix + CK.S_FAIL_EVENT, found.getName());
|
||||||
@ -1619,7 +1619,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_FAIL_EVENT, null);
|
context.setSessionData(stagePrefix + CK.S_FAIL_EVENT, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorEventCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorEventCleared"));
|
||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new FailActionPrompt(context);
|
return new FailActionPrompt(context);
|
||||||
@ -1663,8 +1663,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final @NotNull ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
||||||
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
IAction found = null;
|
IAction found = null;
|
||||||
@ -1675,7 +1674,8 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found == null) {
|
if (found == null) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent").replace("<input>", input));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent")
|
||||||
|
.replace("<input>", input));
|
||||||
return new DeathActionPrompt(context);
|
return new DeathActionPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.setSessionData(stagePrefix + CK.S_DEATH_EVENT, found.getName());
|
context.setSessionData(stagePrefix + CK.S_DEATH_EVENT, found.getName());
|
||||||
@ -1685,7 +1685,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_DEATH_EVENT, null);
|
context.setSessionData(stagePrefix + CK.S_DEATH_EVENT, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorEventCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorEventCleared"));
|
||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new DeathActionPrompt(context);
|
return new DeathActionPrompt(context);
|
||||||
@ -1730,7 +1730,6 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
||||||
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
IAction found = null;
|
IAction found = null;
|
||||||
@ -1741,7 +1740,8 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found == null) {
|
if (found == null) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent").replace("<input>", input));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent")
|
||||||
|
.replace("<input>", input));
|
||||||
return new DisconnectActionPrompt(context);
|
return new DisconnectActionPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.setSessionData(stagePrefix + CK.S_DISCONNECT_EVENT, found.getName());
|
context.setSessionData(stagePrefix + CK.S_DISCONNECT_EVENT, found.getName());
|
||||||
@ -1751,7 +1751,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_DISCONNECT_EVENT, null);
|
context.setSessionData(stagePrefix + CK.S_DISCONNECT_EVENT, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorEventCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorEventCleared"));
|
||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new DisconnectActionPrompt(context);
|
return new DisconnectActionPrompt(context);
|
||||||
@ -1796,7 +1796,6 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
||||||
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
IAction found = null;
|
IAction found = null;
|
||||||
@ -1807,7 +1806,8 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found == null) {
|
if (found == null) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent").replace("<input>", input));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent")
|
||||||
|
.replace("<input>", input));
|
||||||
return new ChatActionPrompt(context);
|
return new ChatActionPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.setSessionData(stagePrefix + CK.S_CHAT_TEMP_EVENT, found.getName());
|
context.setSessionData(stagePrefix + CK.S_CHAT_TEMP_EVENT, found.getName());
|
||||||
@ -1818,7 +1818,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_CHAT_EVENTS, null);
|
context.setSessionData(stagePrefix + CK.S_CHAT_EVENTS, null);
|
||||||
context.setSessionData(stagePrefix + CK.S_CHAT_EVENT_TRIGGERS, null);
|
context.setSessionData(stagePrefix + CK.S_CHAT_EVENT_TRIGGERS, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorChatEventsCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorChatEventsCleared"));
|
||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new ChatActionPrompt(context);
|
return new ChatActionPrompt(context);
|
||||||
@ -1936,8 +1936,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final @NotNull ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
||||||
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
IAction found = null;
|
IAction found = null;
|
||||||
@ -1948,7 +1947,8 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found == null) {
|
if (found == null) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent").replace("<input>", input));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidEvent")
|
||||||
|
.replace("<input>", input));
|
||||||
return new CommandActionPrompt(context);
|
return new CommandActionPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.setSessionData(stagePrefix + CK.S_COMMAND_TEMP_EVENT, found.getName());
|
context.setSessionData(stagePrefix + CK.S_COMMAND_TEMP_EVENT, found.getName());
|
||||||
@ -1959,7 +1959,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_COMMAND_EVENTS, null);
|
context.setSessionData(stagePrefix + CK.S_COMMAND_EVENTS, null);
|
||||||
context.setSessionData(stagePrefix + CK.S_COMMAND_EVENT_TRIGGERS, null);
|
context.setSessionData(stagePrefix + CK.S_COMMAND_EVENT_TRIGGERS, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorCommandEventsCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorCommandEventsCleared"));
|
||||||
return new ActionListPrompt(context);
|
return new ActionListPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new CommandActionPrompt(context);
|
return new CommandActionPrompt(context);
|
||||||
@ -2078,8 +2078,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final @NotNull ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
if (input != null && !input.equalsIgnoreCase(Lang.get("cmdCancel"))
|
||||||
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
&& !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
ICondition found = null;
|
ICondition found = null;
|
||||||
@ -2090,7 +2089,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found == null) {
|
if (found == null) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidCondition")
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidCondition")
|
||||||
.replace("<input>", input));
|
.replace("<input>", input));
|
||||||
return new ConditionListPrompt(context);
|
return new ConditionListPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
@ -2101,7 +2100,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new StageMainPrompt(stageNum, context);
|
return new StageMainPrompt(stageNum, context);
|
||||||
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input != null && input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(stagePrefix + CK.S_CONDITION, null);
|
context.setSessionData(stagePrefix + CK.S_CONDITION, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorConditionCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorConditionCleared"));
|
||||||
return new StageMainPrompt(stageNum, context);
|
return new StageMainPrompt(stageNum, context);
|
||||||
} else {
|
} else {
|
||||||
return new ConditionListPrompt(context);
|
return new ConditionListPrompt(context);
|
||||||
|
Loading…
Reference in New Issue
Block a user