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