mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-28 13:45:32 +01:00
Pass plugin to abandon prompt, fixes #2085
This commit is contained in:
parent
e5322074b8
commit
8b9385c0de
@ -70,6 +70,7 @@ public abstract class CustomRequirement {
|
||||
/**
|
||||
* @deprecated Use {@link #setItem(String, short)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void addItem(final String type, final short durability) {
|
||||
setItem(type, durability);
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ public abstract class CustomReward {
|
||||
/**
|
||||
* @deprecated Use {@link #setItem(String, short)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void addItem(final String type, final short durability) {
|
||||
setItem(type, durability);
|
||||
}
|
||||
|
@ -168,6 +168,7 @@ public class CustomObjective implements ICustomObjective, Listener {
|
||||
/**
|
||||
* @deprecated Do not use
|
||||
*/
|
||||
@Deprecated
|
||||
public Map<String, Object> getDataForPlayerTemp(final Player player, final ICustomObjective customObj,
|
||||
final IQuest quest) {
|
||||
final IQuester quester = plugin.getQuester(player.getUniqueId());
|
||||
@ -208,6 +209,7 @@ public class CustomObjective implements ICustomObjective, Listener {
|
||||
/**
|
||||
* @deprecated Do not use
|
||||
*/
|
||||
@Deprecated
|
||||
public void incrementObjectiveTemp(final Player player, final ICustomObjective obj, final int count,
|
||||
final IQuest quest) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
|
@ -875,7 +875,7 @@ public class Quester implements IQuester {
|
||||
if (settings.canConfirmAbandon()) {
|
||||
final ConversationFactory cf = new ConversationFactory(plugin).withModality(false)
|
||||
.withPrefix(context -> ChatColor.GRAY.toString())
|
||||
.withFirstPrompt(new QuestAbandonPrompt()).withTimeout(settings.getAcceptTimeout())
|
||||
.withFirstPrompt(new QuestAbandonPrompt(plugin)).withTimeout(settings.getAcceptTimeout())
|
||||
.thatExcludesNonPlayersWithMessage("Console may not perform this conversation!")
|
||||
.addConversationAbandonedListener(plugin.getConvoListener());
|
||||
cf.buildConversation(getPlayer()).begin();
|
||||
|
@ -18,11 +18,20 @@ public class QuestAbandonPrompt extends MiscStringPrompt {
|
||||
private ConversationContext context;
|
||||
private final Quests plugin;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public QuestAbandonPrompt() {
|
||||
super(null);
|
||||
plugin = null;
|
||||
}
|
||||
|
||||
public QuestAbandonPrompt(Quests plugin) {
|
||||
super(null);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public QuestAbandonPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
plugin = (Quests)context.getPlugin();
|
||||
@ -75,7 +84,7 @@ public class QuestAbandonPrompt extends MiscStringPrompt {
|
||||
public @NotNull String getPromptText(final @NotNull ConversationContext context) {
|
||||
this.context = context;
|
||||
if (plugin == null) {
|
||||
return ChatColor.YELLOW + Lang.get("unknownError");
|
||||
return ChatColor.YELLOW + Lang.get("itemCreateCriticalError");
|
||||
}
|
||||
|
||||
final MiscPostQuestAbandonEvent event = new MiscPostQuestAbandonEvent(context, this);
|
||||
|
Loading…
Reference in New Issue
Block a user