Use Components in ConverstationManager.java

This commit is contained in:
Len 2022-09-10 13:54:37 +02:00
parent bc2c38263a
commit 439796a7f4

View File

@ -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