diff --git a/.gradle/8.8/executionHistory/executionHistory.bin b/.gradle/8.8/executionHistory/executionHistory.bin index c6dd9c4..d348faa 100644 Binary files a/.gradle/8.8/executionHistory/executionHistory.bin and b/.gradle/8.8/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.8/executionHistory/executionHistory.lock b/.gradle/8.8/executionHistory/executionHistory.lock index 8bc7dca..f2feae8 100644 Binary files a/.gradle/8.8/executionHistory/executionHistory.lock and b/.gradle/8.8/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.8/fileHashes/fileHashes.bin b/.gradle/8.8/fileHashes/fileHashes.bin index ce9d11e..8fcb56f 100644 Binary files a/.gradle/8.8/fileHashes/fileHashes.bin and b/.gradle/8.8/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.8/fileHashes/fileHashes.lock b/.gradle/8.8/fileHashes/fileHashes.lock index f7c9e30..9c6d61c 100644 Binary files a/.gradle/8.8/fileHashes/fileHashes.lock and b/.gradle/8.8/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.8/fileHashes/resourceHashesCache.bin b/.gradle/8.8/fileHashes/resourceHashesCache.bin index 96d6097..62df894 100644 Binary files a/.gradle/8.8/fileHashes/resourceHashesCache.bin and b/.gradle/8.8/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 6342fb1..50fef76 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/build/classes/java/main/CoswayUtil/BlockShop.class b/build/classes/java/main/CoswayUtil/BlockShop.class index 81c0991..8f20ed8 100644 Binary files a/build/classes/java/main/CoswayUtil/BlockShop.class and b/build/classes/java/main/CoswayUtil/BlockShop.class differ diff --git a/build/libs/CoswayUtil-1.12-RELEASE.jar b/build/libs/CoswayUtil-1.12-RELEASE.jar index f570a33..eaec1c0 100644 Binary files a/build/libs/CoswayUtil-1.12-RELEASE.jar and b/build/libs/CoswayUtil-1.12-RELEASE.jar differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/BlockShop.class.uniqueId3 b/build/tmp/compileJava/compileTransaction/stash-dir/BlockShop.class.uniqueId3 new file mode 100644 index 0000000..fc5153d Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/BlockShop.class.uniqueId3 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$2.class.uniqueId3 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$2.class.uniqueId4 similarity index 100% rename from build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$2.class.uniqueId3 rename to build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$2.class.uniqueId4 diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId5 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId6 similarity index 100% rename from build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId5 rename to build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId6 diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId4 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId5 similarity index 100% rename from build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId4 rename to build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId5 diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/IlluminationWand.class.uniqueId6 b/build/tmp/compileJava/compileTransaction/stash-dir/IlluminationWand.class.uniqueId6 deleted file mode 100644 index 69708f3..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/IlluminationWand.class.uniqueId6 and /dev/null differ diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index bb4b1c2..ce09fd0 100644 Binary files a/build/tmp/compileJava/previous-compilation-data.bin and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/src/main/java/CoswayUtil/BlockShop.java b/src/main/java/CoswayUtil/BlockShop.java index 086172d..80b43c6 100644 --- a/src/main/java/CoswayUtil/BlockShop.java +++ b/src/main/java/CoswayUtil/BlockShop.java @@ -171,7 +171,10 @@ public class BlockShop implements Listener { if (clickedItem != null && clickedItem.getType() != Material.AIR) { double price = getPrice(clickedItem); if (!economy.has(player, price)) { - player.sendMessage(ChatColor.RED + getConfigLine("poor", "You don't have enough money to buy this.")); + // Format price with commas + NumberFormat formatter = NumberFormat.getInstance(Locale.US); + String formattedPrice = formatter.format(price); + player.sendMessage(ChatColor.RED + getConfigLine("poor", "You don't have enough money to buy this. for "+formattedPrice)); return; } @@ -197,9 +200,12 @@ public class BlockShop implements Listener { // Finalize the purchase economy.withdrawPlayer(player, price); + // Format price with commas + NumberFormat formatter = NumberFormat.getInstance(Locale.US); + String formattedPrice = formatter.format(price); player.sendMessage(ColorKey("&aYou bought &b" + clickedItem.getAmount() + " &7" + String.valueOf(sold.getType()).toLowerCase().replace("_", " ") + - "&a for &6$" + price)); + "&a for &6$" + formattedPrice)); } } } @@ -238,17 +244,25 @@ public class BlockShop implements Listener { ConfigurationSection itemsSection = config.getConfigurationSection("shop.categories." + category + ".items"); if (itemsSection != null) { for (String itemKey : itemsSection.getKeys(false)) { + // Retrieve the material from the config String materialName = config.getString("shop.categories." + category + ".items." + itemKey + ".material"); if (materialName != null && item.getType() == Material.matchMaterial(materialName.toUpperCase())) { - return config.getDouble("shop.categories." + category + ".items." + itemKey + ".price", 0); + // Retrieve the display name from the config + String displayName = config.getString("shop.categories." + category + ".items." + itemKey + ".display_name"); + + // Compare the display name in the config with the one on the item + if (displayName != null && displayName != null && displayName.equals(displayName)) { + return config.getDouble("shop.categories." + category + ".items." + itemKey + ".price", 0); + } } } } } - return 0; // Default to 0 if no price is found + return 1000000000; // Default to 1t if no price is found } + // Register the block shop commands and events public void register() { plugin.getServer().getPluginManager().registerEvents(this, plugin);