diff --git a/main/src/main/java/me/blackvein/quests/QuestFactory.java b/main/src/main/java/me/blackvein/quests/QuestFactory.java index 4ffae1586..181ae2b8c 100644 --- a/main/src/main/java/me/blackvein/quests/QuestFactory.java +++ b/main/src/main/java/me/blackvein/quests/QuestFactory.java @@ -250,8 +250,8 @@ public class QuestFactory implements ConversationAbandonedListener { } public String getTitle(ConversationContext context) { - return Lang.get("quest") + ": " + context.getSessionData(CK.Q_NAME) + " " + ChatColor.GRAY - + (context.getSessionData(CK.Q_ID) != null ? "(" + Lang.get("id") + ":" + return Lang.get("quest") + ": " + context.getSessionData(CK.Q_NAME) + "" + ChatColor.GRAY + + (context.getSessionData(CK.Q_ID) != null ? " (" + Lang.get("id") + ":" + context.getSessionData(CK.Q_ID) + ")": ""); } @@ -529,6 +529,11 @@ public class QuestFactory implements ConversationAbandonedListener { @Override public Prompt acceptInput(ConversationContext context, String input) { + if (input == null) { + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); + return new QuestSelectCreatePrompt(plugin, context, QuestFactory.this); + } + input = input.trim(); if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { for (Quest q : plugin.getQuests()) { if (q.getName().equalsIgnoreCase(input)) { @@ -544,6 +549,10 @@ public class QuestFactory implements ConversationAbandonedListener { context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidQuestName")); return new QuestSelectCreatePrompt(plugin, context, QuestFactory.this); } + if (input.equals("")) { + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); + return new QuestSelectCreatePrompt(plugin, context, QuestFactory.this); + } context.setSessionData(CK.Q_NAME, input); names.add(input); return new QuestMainPrompt(plugin, context, QuestFactory.this); diff --git a/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java b/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java index 65b19d603..6600a330e 100644 --- a/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java +++ b/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java @@ -462,6 +462,11 @@ public class ActionFactory implements ConversationAbandonedListener { @Override public Prompt acceptInput(ConversationContext context, String input) { + if (input == null) { + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); + return new ActionSelectCreatePrompt(context, ActionFactory.this); + } + input = input.trim(); if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) { for (Action e : plugin.getActions()) { if (e.getName().equalsIgnoreCase(input)) { @@ -477,6 +482,10 @@ public class ActionFactory implements ConversationAbandonedListener { context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorAlpha")); return new ActionSelectCreatePrompt(context, ActionFactory.this); } + if (input.equals("")) { + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidInput")); + return new ActionSelectCreatePrompt(context, ActionFactory.this); + } context.setSessionData(CK.E_NAME, input); names.add(input); return new ActionMainPrompt(context, ActionFactory.this);