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,10 +213,17 @@ public class BlockShop implements Listener {
return sb.toString();
}
public String getConfigLine(String source, String dfault) {
plugin.reloadConfig();
return config != null ? config.getString(source, dfault) : dfault;
reloadShopConfig();
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)
private double getPrice(ItemStack item) {
for (String category : config.getConfigurationSection("shop.categories").getKeys(false)) {

View File

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