added new config string fetches for more dynamic dialog configs

This commit is contained in:
kai ohara 2025-02-13 20:29:09 -05:00
parent a23a00c881
commit 426fc4a977
12 changed files with 10 additions and 2 deletions

View File

@ -213,9 +213,16 @@ public class BlockShop implements Listener {
return sb.toString(); return sb.toString();
} }
public String getConfigLine(String source, String dfault) { public String getConfigLine(String source, String dfault) {
plugin.reloadConfig(); reloadShopConfig();
return config != null ? config.getString(source, dfault) : dfault; String value = plugin.getConfig().getString(source, dfault);
if (!config.contains(source)) {
config.set(source, dfault);
plugin.saveConfig();
} }
Bukkit.getLogger().info("Fetching config key: " + source + " | Found: " + value);
return value;
}
// Helper method to retrieve the price of an item (can be customized to use a config file for prices) // Helper method to retrieve the price of an item (can be customized to use a config file for prices)
private double getPrice(ItemStack item) { private double getPrice(ItemStack item) {

View File

@ -13,5 +13,6 @@ shop:
price: 15 price: 15
display_name: "Oak Planks" display_name: "Oak Planks"
poor: "you're poor..." poor: "you're poor..."
inventory_full: "you got too much clutter, cant fit your purchase into that mess..."
pagination: pagination:
max_items_per_page: 45 # Max items to display per page max_items_per_page: 45 # Max items to display per page