diff --git a/pom.xml b/pom.xml
index 95a7b6b..af9bff6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.NVus
NVus_Prison
- 1.0.1
+ 1.0.2
jar
NVus_PrisonSetup
diff --git a/src/main/java/me/nvus/nvus_prison_setup/AutoSell/SellManager.java b/src/main/java/me/nvus/nvus_prison_setup/AutoSell/SellManager.java
index e517c17..c59aacb 100644
--- a/src/main/java/me/nvus/nvus_prison_setup/AutoSell/SellManager.java
+++ b/src/main/java/me/nvus/nvus_prison_setup/AutoSell/SellManager.java
@@ -105,10 +105,23 @@ public class SellManager implements CommandExecutor {
String materialName = material.name();
FileConfiguration itemPricesConfig = configManager.getItemPricesConfig();
- itemPricesConfig.set("Prices." + materialName + ".Sell", price);
+ // Check if the price is 0, indicating the item should be removed
+ if (price == 0) {
+ // Check if the item already exists in the config
+ if (itemPricesConfig.contains("Prices." + materialName)) {
+ itemPricesConfig.set("Prices." + materialName, null); // Remove the item
+ player.sendMessage(ChatColor.GREEN + "The price of " + materialName + " has been removed.");
+ } else {
+ player.sendMessage(ChatColor.RED + "No price was set for " + materialName + ", nothing to remove.");
+ }
+ } else {
+ itemPricesConfig.set("Prices." + materialName + ".Sell", price);
+ player.sendMessage(ChatColor.GREEN + "The price of " + materialName + " has been set to $" + price + ".");
+ }
+
+ // Save and reload the config regardless of the action taken
try {
itemPricesConfig.save(new File(configManager.getDataFolder(), "item_prices.yml"));
- player.sendMessage(ChatColor.GREEN + "The price of " + materialName + " has been set to $" + price + ".");
configManager.reloadConfig("item_prices.yml");
configManager.reorderItemPrices();
reloadPrices();
@@ -119,6 +132,7 @@ public class SellManager implements CommandExecutor {
}
+
private void toggleAutoSell(Player player) {
boolean currentStatus = autoSellStatus.getOrDefault(player.getUniqueId(), false);
autoSellStatus.put(player.getUniqueId(), !currentStatus); // Toggle the status
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 8290d3a..73bb583 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -60,9 +60,9 @@ commands:
/autosell - Toggle auto selling all eligible items in your inventory.
aliases: [ automaticsell ]
setprice:
- description: Set the price of the block being held in item_prices.yml.
+ description: Set the price of the block being held in item_prices.yml. Set the price to 0 to remove it from the list!
usage: |
- /setprice - Set the price of the block being held in item_prices.yml.
+ /setprice - Set the price of the block being held in item_prices.yml. Set the price to 0 to remove it from the list!
aliases: [ setblockprice ]
rankup:
description: Rank up to the next rank.