mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-24 11:38:42 +01:00
aims to fix #975
This commit is contained in:
parent
35d326d74f
commit
851516957a
@ -13,7 +13,9 @@
|
||||
package me.blackvein.quests.prompts;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -31,8 +33,8 @@ import me.blackvein.quests.util.Lang;
|
||||
public class QuestOfferPrompt extends StringPrompt {
|
||||
|
||||
private final Quests plugin;
|
||||
private Quester quester;
|
||||
private LinkedList<Quest> quests;
|
||||
private HashMap<UUID, Quester> questerHashMap = new HashMap<>();
|
||||
private HashMap<UUID, LinkedList<Quest>> questsHashMap = new HashMap<>();
|
||||
|
||||
public QuestOfferPrompt(Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
@ -41,6 +43,8 @@ public class QuestOfferPrompt extends StringPrompt {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
Quester quester;
|
||||
LinkedList<Quest> quests;
|
||||
quests = (LinkedList<Quest>) cc.getSessionData("quests");
|
||||
quester = plugin.getQuester(((Player) cc.getForWhom()).getUniqueId());
|
||||
String npc = (String) cc.getSessionData("npc");
|
||||
@ -60,11 +64,15 @@ public class QuestOfferPrompt extends StringPrompt {
|
||||
menu += ChatColor.GOLD + "" + ChatColor.BOLD + "" + (quests.size() + 1) + ". " + ChatColor.RESET + ""
|
||||
+ ChatColor.GRAY + Lang.get("cancel") + "\n";
|
||||
menu += ChatColor.WHITE + Lang.get("enterAnOption");
|
||||
questerHashMap.put(((Player) cc.getForWhom()).getUniqueId(), quester);
|
||||
questsHashMap.put(((Player) cc.getForWhom()).getUniqueId(), quests);
|
||||
return menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
Quester quester = questerHashMap.get(((Player) cc.getForWhom()).getUniqueId());
|
||||
LinkedList<Quest> quests = questsHashMap.get(((Player) cc.getForWhom()).getUniqueId());
|
||||
int numInput = -1;
|
||||
try {
|
||||
numInput = Integer.parseInt(input);
|
||||
|
Loading…
Reference in New Issue
Block a user