v1.0.2 - Added /nvus id to get your minecraft username, UUID and a clickable text UUID. Also added the ability to use /setprice 0 to remove the item in your hand from the item_prices.yml file. Still works doing /setprice <price> to add the item in your hand to the price list etc.
This commit is contained in:
parent
b48bcb7688
commit
9de1283127
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>me.NVus</groupId>
|
||||
<artifactId>NVus_Prison</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>NVus_PrisonSetup</name>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <price> - Set the price of the block being held in item_prices.yml.
|
||||
/setprice <price> - 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.
|
||||
|
|
Loading…
Reference in New Issue