From 439796a7f45d0adb5ce813a37a08c5fce0ca12b4 Mon Sep 17 00:00:00 2001 From: Len <40720638+destro174@users.noreply.github.com> Date: Sat, 10 Sep 2022 13:54:37 +0200 Subject: [PATCH] Use Components in ConverstationManager.java --- .../conversation/ConversationManager.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/alttd/playershops/conversation/ConversationManager.java b/src/main/java/com/alttd/playershops/conversation/ConversationManager.java index b8d9caf..e7c0872 100644 --- a/src/main/java/com/alttd/playershops/conversation/ConversationManager.java +++ b/src/main/java/com/alttd/playershops/conversation/ConversationManager.java @@ -4,7 +4,9 @@ import com.alttd.playershops.gui.ShopManagementGui; import com.alttd.playershops.shop.PlayerShop; import com.alttd.playershops.shop.ShopType; import com.alttd.playershops.utils.EconomyUtils; +import com.alttd.playershops.utils.Util; import com.google.common.base.Joiner; +import net.kyori.adventure.text.Component; import org.bukkit.conversations.*; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -71,8 +73,8 @@ public class ConversationManager implements ConversationAbandonedListener { super("buy", "sell", "none"); // todo can this be automated shoptype.values() } - public @NotNull String getPromptText(ConversationContext context) { - return "What shoptype would you like to use: " + Joiner.on(", ").join(fixedSet) + " Type cancel to cancel this action."; + public @NotNull Component getPromptMessage(ConversationContext context) { + return Util.parseMiniMessage("What shoptype would you like to use: " + Joiner.on(", ").join(fixedSet) + " Type cancel to cancel this action."); } @Override @@ -87,8 +89,8 @@ public class ConversationManager implements ConversationAbandonedListener { private class ChangePricePrompt extends NumericPrompt { - public @NotNull String getPromptText(ConversationContext context) { - return "What should the price be? Type cancel to cancel this action."; + public @NotNull Component getPromptMessage(ConversationContext context) { // TODO load from config? + return Util.parseMiniMessage("What should the price be? Type cancel to cancel this action."); } @Override @@ -112,8 +114,8 @@ public class ConversationManager implements ConversationAbandonedListener { private class ChangeAmountPrompt extends NumericPrompt { - public @NotNull String getPromptText(ConversationContext context) { - return "How many items would you like to sell? Type cancel to cancel this action."; + public @NotNull Component getPromptMessage(ConversationContext context) { // TODO load from config? + return Util.parseMiniMessage("How many items would you like to sell? Type cancel to cancel this action."); } @Override @@ -137,8 +139,8 @@ public class ConversationManager implements ConversationAbandonedListener { private class AddBalancePrompt extends NumericPrompt { - public @NotNull String getPromptText(ConversationContext context) { - return "How much money would you like to add? Type cancel to cancel this action."; + public @NotNull Component getPromptMessage(ConversationContext context) { // TODO load from config? + return Util.parseMiniMessage("How much money would you like to add? Type cancel to cancel this action."); } @Override @@ -165,8 +167,8 @@ public class ConversationManager implements ConversationAbandonedListener { private class WithdrawBalancePrompt extends NumericPrompt { - public @NotNull String getPromptText(ConversationContext context) { - return "How much money would you like to withdraw? Type cancel to cancel this action."; + public @NotNull Component getPromptMessage(ConversationContext context) { // TODO load from config? + return Util.parseMiniMessage("How much money would you like to withdraw? Type cancel to cancel this action."); } @Override @@ -197,8 +199,8 @@ public class ConversationManager implements ConversationAbandonedListener { super("continue"); } - public @NotNull String getPromptText(ConversationContext context) { - return "Hold the item you would like to sell and type continue? Type cancel to cancel this action."; + public @NotNull Component getPromptMessage(ConversationContext context) { // TODO load from config? + return Util.parseMiniMessage("Hold the item you would like to sell and type continue? Type cancel to cancel this action."); } @Override