forked from never2nv/NVus_Prison
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>
|
<groupId>me.NVus</groupId>
|
||||||
<artifactId>NVus_Prison</artifactId>
|
<artifactId>NVus_Prison</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>1.0.2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>NVus_PrisonSetup</name>
|
<name>NVus_PrisonSetup</name>
|
||||||
|
|
|
@ -105,10 +105,23 @@ public class SellManager implements CommandExecutor {
|
||||||
String materialName = material.name();
|
String materialName = material.name();
|
||||||
|
|
||||||
FileConfiguration itemPricesConfig = configManager.getItemPricesConfig();
|
FileConfiguration itemPricesConfig = configManager.getItemPricesConfig();
|
||||||
|
// 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);
|
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 {
|
try {
|
||||||
itemPricesConfig.save(new File(configManager.getDataFolder(), "item_prices.yml"));
|
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.reloadConfig("item_prices.yml");
|
||||||
configManager.reorderItemPrices();
|
configManager.reorderItemPrices();
|
||||||
reloadPrices();
|
reloadPrices();
|
||||||
|
@ -119,6 +132,7 @@ public class SellManager implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void toggleAutoSell(Player player) {
|
private void toggleAutoSell(Player player) {
|
||||||
boolean currentStatus = autoSellStatus.getOrDefault(player.getUniqueId(), false);
|
boolean currentStatus = autoSellStatus.getOrDefault(player.getUniqueId(), false);
|
||||||
autoSellStatus.put(player.getUniqueId(), !currentStatus); // Toggle the status
|
autoSellStatus.put(player.getUniqueId(), !currentStatus); // Toggle the status
|
||||||
|
|
|
@ -60,9 +60,9 @@ commands:
|
||||||
/autosell - Toggle auto selling all eligible items in your inventory.
|
/autosell - Toggle auto selling all eligible items in your inventory.
|
||||||
aliases: [ automaticsell ]
|
aliases: [ automaticsell ]
|
||||||
setprice:
|
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: |
|
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 ]
|
aliases: [ setblockprice ]
|
||||||
rankup:
|
rankup:
|
||||||
description: Rank up to the next rank.
|
description: Rank up to the next rank.
|
||||||
|
|
Loading…
Reference in New Issue