Load conversation prompts from MessageConfig.java
This commit is contained in:
@@ -40,4 +40,25 @@ public class MessageConfig extends AbstractConfiguration {
|
||||
private static void otherMessages() {
|
||||
SHOP_INFO = config.getString("messages.shop-info", SHOP_INFO);
|
||||
}
|
||||
|
||||
public static String CHANGE_PRICE_PROMPT = "What should the price be? Type cancel to cancel this action.";
|
||||
public static String CHANGE_PRICE_FAILED_PROMPT = "Input must 0 or higher. Type cancel to cancel this action.";
|
||||
public static String CHANGE_AMOUNT_PROMPT = "How many items would you like to sell? Type cancel to cancel this action.";
|
||||
public static String CHANGE_AMOUNT_FAILED_PROMPT = "Input must be between 1 and 3456. Type cancel to cancel this action.";
|
||||
public static String ADD_BALANCE_PROMPT = "How much money would you like to add? Type cancel to cancel this action.";
|
||||
public static String ADD_BALANCE_FAILED_PROMPT = "You do not have enough balance to deposit this amount. Type cancel to cancel this action.";
|
||||
public static String WITHDRAW_BALANCE_PROMPT = "How much money would you like to withdraw? Type cancel to cancel this action.";
|
||||
public static String WITHDRAW_BALANCE_FAILED_PROMPT = "Your shop does not have enough balance to withdraw this amount. Type cancel to cancel this action.";
|
||||
public static String CHANGE_ITEM_PROMPT = "Hold the item you would like to sell and type continue. Type cancel to cancel this action.";
|
||||
private static void promptMessages() {
|
||||
CHANGE_PRICE_PROMPT = config.getString("prompt.change-price", CHANGE_PRICE_PROMPT);
|
||||
CHANGE_PRICE_FAILED_PROMPT = config.getString("prompt.change-price-failed", CHANGE_PRICE_FAILED_PROMPT);
|
||||
CHANGE_AMOUNT_PROMPT = config.getString("prompt.change-amount", CHANGE_AMOUNT_PROMPT);
|
||||
CHANGE_AMOUNT_FAILED_PROMPT = config.getString("prompt.change-amount-failed", CHANGE_AMOUNT_FAILED_PROMPT);
|
||||
ADD_BALANCE_PROMPT = config.getString("prompt.add-balance", ADD_BALANCE_PROMPT);
|
||||
ADD_BALANCE_FAILED_PROMPT = config.getString("prompt.add-balance-failed", ADD_BALANCE_FAILED_PROMPT);
|
||||
WITHDRAW_BALANCE_PROMPT = config.getString("prompt.withdraw-balance", WITHDRAW_BALANCE_PROMPT);
|
||||
WITHDRAW_BALANCE_FAILED_PROMPT = config.getString("prompt.withdraw-balance-failed", WITHDRAW_BALANCE_FAILED_PROMPT);
|
||||
CHANGE_ITEM_PROMPT = config.getString("prompt.change-item",CHANGE_ITEM_PROMPT );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.alttd.playershops.conversation;
|
||||
|
||||
import com.alttd.playershops.config.MessageConfig;
|
||||
import com.alttd.playershops.gui.ShopManagementGui;
|
||||
import com.alttd.playershops.shop.PlayerShop;
|
||||
import com.alttd.playershops.shop.ShopType;
|
||||
@@ -70,7 +71,7 @@ public class ConversationManager implements ConversationAbandonedListener {
|
||||
private class ChangeTypePrompt extends FixedSetPrompt {
|
||||
|
||||
public ChangeTypePrompt() {
|
||||
super("buy", "sell", "none"); // todo can this be automated shoptype.values()
|
||||
super("buy", "sell", "none");
|
||||
}
|
||||
|
||||
public @NotNull Component getPromptMessage(ConversationContext context) {
|
||||
@@ -89,8 +90,8 @@ public class ConversationManager implements ConversationAbandonedListener {
|
||||
|
||||
private class ChangePricePrompt extends NumericPrompt {
|
||||
|
||||
public @NotNull Component getPromptMessage(ConversationContext context) { // TODO load from config?
|
||||
return Util.parseMiniMessage("What should the price be? Type cancel to cancel this action.");
|
||||
public @NotNull Component getPromptMessage(ConversationContext context) {
|
||||
return Util.parseMiniMessage(MessageConfig.CHANGE_PRICE_PROMPT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,7 +101,7 @@ public class ConversationManager implements ConversationAbandonedListener {
|
||||
|
||||
@Override
|
||||
protected String getFailedValidationText(ConversationContext context, Number invalidInput) {
|
||||
return "Input must 0 or higher. Type cancel to cancel this action.";
|
||||
return MessageConfig.CHANGE_PRICE_FAILED_PROMPT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,8 +115,8 @@ public class ConversationManager implements ConversationAbandonedListener {
|
||||
|
||||
private class ChangeAmountPrompt extends NumericPrompt {
|
||||
|
||||
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.");
|
||||
public @NotNull Component getPromptMessage(ConversationContext context) {
|
||||
return Util.parseMiniMessage(MessageConfig.CHANGE_AMOUNT_PROMPT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,7 +126,7 @@ public class ConversationManager implements ConversationAbandonedListener {
|
||||
|
||||
@Override
|
||||
protected String getFailedValidationText(ConversationContext context, Number invalidInput) {
|
||||
return "Input must be between 1 and 3456. Type cancel to cancel this action.";
|
||||
return MessageConfig.CHANGE_AMOUNT_FAILED_PROMPT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,8 +140,8 @@ public class ConversationManager implements ConversationAbandonedListener {
|
||||
|
||||
private class AddBalancePrompt extends NumericPrompt {
|
||||
|
||||
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.");
|
||||
public @NotNull Component getPromptMessage(ConversationContext context) {
|
||||
return Util.parseMiniMessage(MessageConfig.ADD_BALANCE_PROMPT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,7 +153,7 @@ public class ConversationManager implements ConversationAbandonedListener {
|
||||
|
||||
@Override
|
||||
protected String getFailedValidationText(ConversationContext context, Number invalidInput) {
|
||||
return "You do not have enough balance to deposit this amount. Type cancel to cancel this action.";
|
||||
return MessageConfig.ADD_BALANCE_FAILED_PROMPT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,8 +168,8 @@ public class ConversationManager implements ConversationAbandonedListener {
|
||||
|
||||
private class WithdrawBalancePrompt extends NumericPrompt {
|
||||
|
||||
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.");
|
||||
public @NotNull Component getPromptMessage(ConversationContext context) {
|
||||
return Util.parseMiniMessage(MessageConfig.WITHDRAW_BALANCE_PROMPT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,7 +181,7 @@ public class ConversationManager implements ConversationAbandonedListener {
|
||||
|
||||
@Override
|
||||
protected String getFailedValidationText(ConversationContext context, Number invalidInput) {
|
||||
return "Your shop does not have enough balance to withdraw this amount. Type cancel to cancel this action.";
|
||||
return MessageConfig.WITHDRAW_BALANCE_FAILED_PROMPT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -199,8 +200,8 @@ public class ConversationManager implements ConversationAbandonedListener {
|
||||
super("continue");
|
||||
}
|
||||
|
||||
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.");
|
||||
public @NotNull Component getPromptMessage(ConversationContext context) {
|
||||
return Util.parseMiniMessage(MessageConfig.CHANGE_ITEM_PROMPT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user