mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
Update for latest Conversations 2
This commit is contained in:
parent
c5c7bafa8f
commit
5838e88632
@ -179,9 +179,9 @@
|
||||
<version>2.17.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.Browsit</groupId>
|
||||
<artifactId>ConversationAPI</artifactId>
|
||||
<version>158a0ee8e3</version>
|
||||
<groupId>com.github.Browsit.ConversationAPI</groupId>
|
||||
<artifactId>conversation-bukkit</artifactId>
|
||||
<version>f5e587e641</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.pikamug.quests</groupId>
|
||||
|
@ -51,12 +51,10 @@ import me.pikamug.quests.tasks.BukkitNpcEffectThread;
|
||||
import me.pikamug.quests.tasks.BukkitPlayerMoveThread;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.BukkitUpdateChecker;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.browsit.conversations.api.Conversations;
|
||||
import org.browsit.conversations.bukkit.BukkitConversations;
|
||||
import org.browsit.conversations.bukkit.BukkitConversationsForwarder;
|
||||
import org.browsit.conversations.impl.provider.AdventureConversationsProvider;
|
||||
import org.browsit.libs.kyori.adventure.platform.AudienceProvider;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -127,7 +125,7 @@ public class BukkitQuestsPlugin extends JavaPlugin implements Quests {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
/*----> WARNING: ORDER OF STEPS MATTERS <----*/
|
||||
Conversations.init(AdventureConversationsProvider.create((AudienceProvider) BukkitAudiences.create(this)));
|
||||
BukkitConversations.init(this);
|
||||
new BukkitConversationsForwarder().register(this);
|
||||
|
||||
// 1 - Trigger server to initialize Legacy Material Support
|
||||
|
@ -6,8 +6,6 @@ import me.pikamug.quests.util.BukkitLang;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.browsit.conversations.api.Conversations;
|
||||
import org.browsit.conversations.api.action.Prompt;
|
||||
import org.browsit.conversations.api.data.Conversation;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -112,24 +110,22 @@ public class QuestAcceptPrompt {
|
||||
} else {
|
||||
quester.takeQuest(plugin.getQuestById(questIdToTake), false);
|
||||
}
|
||||
return;
|
||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase("n")
|
||||
|| input.equalsIgnoreCase(BukkitLang.get("noWord"))
|
||||
|| input.equalsIgnoreCase(BukkitLang.get(player, "noWord"))) {
|
||||
BukkitLang.send(player, ChatColor.YELLOW + BukkitLang.get("cancelled"));
|
||||
return;
|
||||
} else {
|
||||
final String msg = BukkitLang.get(player, "questInvalidChoice")
|
||||
.replace("<yes>", BukkitLang.get(player, "yesWord"))
|
||||
.replace("<no>", BukkitLang.get(player, "noWord"));
|
||||
BukkitLang.send(player, ChatColor.RED + msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void start() {
|
||||
Conversations.create(uuid)
|
||||
.prompt(getPromptText(uuid), String.class, prompt -> prompt
|
||||
.converter(String::valueOf)
|
||||
.fetch((input, sender) -> acceptInput(uuid, input)))
|
||||
.start();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user