Update for latest Conversations

This commit is contained in:
PikaMug 2024-01-25 15:03:24 -05:00
parent 71e2b82984
commit c5c7bafa8f
3 changed files with 8 additions and 5 deletions

View File

@ -181,7 +181,7 @@
<dependency>
<groupId>com.github.Browsit</groupId>
<artifactId>ConversationAPI</artifactId>
<version>67983728aa</version>
<version>158a0ee8e3</version>
</dependency>
<dependency>
<groupId>me.pikamug.quests</groupId>

View File

@ -55,6 +55,8 @@ import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import org.apache.logging.log4j.LogManager;
import org.browsit.conversations.api.Conversations;
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;
@ -125,7 +127,7 @@ public class BukkitQuestsPlugin extends JavaPlugin implements Quests {
@Override
public void onEnable() {
/*----> WARNING: ORDER OF STEPS MATTERS <----*/
Conversations.init(BukkitAudiences.create(this));
Conversations.init(AdventureConversationsProvider.create((AudienceProvider) BukkitAudiences.create(this)));
new BukkitConversationsForwarder().register(this);
// 1 - Trigger server to initialize Legacy Material Support

View File

@ -5,6 +5,7 @@ import me.pikamug.quests.player.Quester;
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;
@ -127,9 +128,9 @@ public class QuestAcceptPrompt {
}
public void start() {
new Conversation(uuid)
.prompt(new Prompt<String>(getPromptText(uuid))
Conversations.create(uuid)
.prompt(getPromptText(uuid), String.class, prompt -> prompt
.fetch((input, sender) -> acceptInput(uuid, input)))
.run();
.start();
}
}