diff --git a/assets/plugin_cover_photo.png b/assets/plugin_cover_photo.png
index 55a9d11..865b33d 100644
Binary files a/assets/plugin_cover_photo.png and b/assets/plugin_cover_photo.png differ
diff --git a/assets/plugin_info.png b/assets/plugin_info.png
index 63b6ea8..a779fe3 100644
Binary files a/assets/plugin_info.png and b/assets/plugin_info.png differ
diff --git a/assets/plugin_info_2.png b/assets/plugin_info_2.png
index 7757758..e297575 100644
Binary files a/assets/plugin_info_2.png and b/assets/plugin_info_2.png differ
diff --git a/assets/plugin_menu.png b/assets/plugin_menu.png
index 96d9e2a..29c9536 100644
Binary files a/assets/plugin_menu.png and b/assets/plugin_menu.png differ
diff --git a/pom.xml b/pom.xml
index 317b025..cc61a14 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.NVus
NVus_Prison
- 0.9.8
+ 1.0.0
jar
NVus_PrisonSetup
diff --git a/src/main/java/me/nvus/nvus_prison_setup/AutoSell/Listeners/AutoSellListener.java b/src/main/java/me/nvus/nvus_prison_setup/AutoSell/Listeners/AutoSellListener.java
index 6e7ac63..a422185 100644
--- a/src/main/java/me/nvus/nvus_prison_setup/AutoSell/Listeners/AutoSellListener.java
+++ b/src/main/java/me/nvus/nvus_prison_setup/AutoSell/Listeners/AutoSellListener.java
@@ -22,17 +22,6 @@ public class AutoSellListener implements Listener {
if (!player.hasPermission("nvus.prisoner") || !sellManager.isAutoSellEnabled(player)) {
return;
}
-
- Block block = event.getBlock();
- ItemStack tool = player.getInventory().getItemInMainHand();
-
- block.getDrops(tool).forEach(drop -> {
- Material dropType = drop.getType();
- if (sellManager.isSellable(dropType)) {
- sellManager.sellBlockDrop(player, dropType, drop.getAmount());
- block.setType(Material.AIR); // Remove the block after "selling" its drop
- event.setDropItems(false); // Prevent dropping the item
- }
- });
+ sellManager.sellItems(player);
}
}
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 de860a5..e517c17 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
@@ -3,14 +3,18 @@ package me.nvus.nvus_prison_setup.AutoSell;
import me.nvus.nvus_prison_setup.Configs.ConfigManager;
import me.nvus.nvus_prison_setup.PrisonSetup;
import net.milkbowl.vault.economy.Economy;
+import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
+import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import java.io.File;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@@ -26,7 +30,6 @@ public class SellManager implements CommandExecutor {
loadPrices();
}
- @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can use this command.");
@@ -35,6 +38,26 @@ public class SellManager implements CommandExecutor {
Player player = (Player) sender;
+ // Admin Commands:
+ if ("setprice".equalsIgnoreCase(command.getName())) {
+ if (player.hasPermission("nvus.admin")) {
+ if (args.length != 1) {
+ player.sendMessage(ChatColor.RED + "Usage: /setprice ");
+ return true;
+ }
+ try {
+ double price = Double.parseDouble(args[0]);
+ setPrice(player, price);
+ } catch (NumberFormatException e) {
+ player.sendMessage(ChatColor.RED + "Please provide a valid price.");
+ }
+ } else {
+ player.sendMessage(ChatColor.RED + "You do not have permission to set prices.");
+ }
+ return true;
+ }
+
+ // Player/Prisoner Commands:
switch (command.getName().toLowerCase()) {
case "autosell":
toggleAutoSell(player);
@@ -49,23 +72,58 @@ public class SellManager implements CommandExecutor {
private void loadPrices() {
FileConfiguration itemPricesConfig = configManager.getItemPricesConfig();
- for (String key : itemPricesConfig.getConfigurationSection("Prices").getKeys(false)) {
- String materialName = itemPricesConfig.getString("Prices." + key + ".Material");
- Material material = Material.matchMaterial(materialName);
- double price = itemPricesConfig.getDouble("Prices." + key + ".Sell");
+ ConfigurationSection pricesSection = itemPricesConfig.getConfigurationSection("Prices");
+ if (pricesSection == null) {
+ System.err.println("Prices section not found in item_prices.yml");
+ return;
+ }
+ for (String key : pricesSection.getKeys(false)) {
+ Material material = Material.matchMaterial(key);
+ double price = pricesSection.getDouble(key + ".Sell");
if (material != null) {
prices.put(material, price);
} else {
- System.err.println("Invalid material in item_prices.yml: " + materialName);
+ System.err.println("Invalid material in item_prices.yml: " + key);
}
}
}
+ public void reloadPrices() {
+ prices.clear(); // Clear existing prices to avoid duplicates
+ loadPrices(); // Reload prices
+ }
+
+ private void setPrice(Player player, double price) {
+ ItemStack itemInHand = player.getInventory().getItemInMainHand();
+ if (itemInHand == null || itemInHand.getType() == Material.AIR) {
+ player.sendMessage(ChatColor.RED + "You must be holding an item to set its price!");
+ return;
+ }
+
+ Material material = itemInHand.getType();
+ String materialName = material.name();
+
+ FileConfiguration itemPricesConfig = configManager.getItemPricesConfig();
+ itemPricesConfig.set("Prices." + materialName + ".Sell", price);
+ 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();
+ } catch (IOException e) {
+ player.sendMessage(ChatColor.RED + "There was a problem saving the price.");
+ e.printStackTrace();
+ }
+ }
+
+
private void toggleAutoSell(Player player) {
boolean currentStatus = autoSellStatus.getOrDefault(player.getUniqueId(), false);
autoSellStatus.put(player.getUniqueId(), !currentStatus); // Toggle the status
- player.sendMessage("AutoSell is now " + (autoSellStatus.get(player.getUniqueId()) ? "enabled!" : "disabled!"));
+ player.sendMessage(ChatColor.translateAlternateColorCodes('&', String.format("&a&lAutoSell is now %s!", (autoSellStatus.get(player.getUniqueId()) ? "&a&lenabled" : "&c&ldisabled"))));
+ //player.sendMessage("AutoSell is now " + (autoSellStatus.get(player.getUniqueId()) ? "enabled!" : "disabled!"));
}
public boolean isAutoSellEnabled(Player player) {
@@ -75,45 +133,67 @@ public class SellManager implements CommandExecutor {
public void sellItems(Player player) {
if (!player.hasPermission("nvus.prisoner")) {
- player.sendMessage("You do not have permission to use this command.");
+ player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lYou do not have permission to use this command."));
return;
}
- double totalSale = 0;
- ItemStack[] items = player.getInventory().getContents();
- for (ItemStack item : items) {
+ Map soldItems = new HashMap<>();
+
+ // Loop through the player's inventory and collect sellable items
+ for (ItemStack item : player.getInventory().getContents()) {
if (item != null && prices.containsKey(item.getType())) {
- double pricePerItem = prices.get(item.getType());
- totalSale += pricePerItem * item.getAmount();
+ soldItems.merge(item.getType(), item.getAmount(), Integer::sum);
player.getInventory().remove(item);
}
}
- if (totalSale > 0) {
- giveMoney(player, totalSale);
- // We send the message of amount give in the giveMoney method now!!
- //player.sendMessage(String.format("Sold items for $%.2f", totalSale));
- } else {
- player.sendMessage("No eligible items to sell.");
- }
+ // Sell the items that we just removed from their inventory
+ soldItems.forEach((material, quantity) -> {
+ double totalSale = prices.get(material) * quantity;
+ giveMoney(player, material, quantity, totalSale);
+ });
}
- private void giveMoney(Player player, double amount) {
+ private void giveMoney(Player player, Material material, int quantity, double amount) {
Economy economy = PrisonSetup.getEconomy();
economy.depositPlayer(player, amount);
- player.sendMessage(String.format("You've been given $%.2f", amount));
+ player.sendMessage(ChatColor.translateAlternateColorCodes('&',
+ String.format("&a&lSold &d%dx &3%s &a&lfor $%.2f", quantity, material.toString().toLowerCase().replaceAll("_", " "), amount)));
}
- public void sellBlockDrop(Player player, Material material, int amount) {
- if (!isSellable(material)) {
- return;
- }
- double price = getPrice(material) * amount;
- if (price > 0) {
- giveMoney(player, price);
- player.sendMessage(String.format("Sold %s x%d for $%.2f", material.toString(), amount, price));
- }
- }
+
+
+// public void sellItems(Player player) {
+// if (!player.hasPermission("nvus.prisoner")) {
+// player.sendMessage(ChatColor.translateAlternateColorCodes('&', String.format("&c&lYou do not have permission to use this command.")));
+// //player.sendMessage("You do not have permission to use this command.");
+// return;
+// }
+//
+// double totalSale = 0;
+// ItemStack[] items = player.getInventory().getContents();
+// for (ItemStack item : items) {
+// if (item != null && prices.containsKey(item.getType())) {
+// double pricePerItem = prices.get(item.getType());
+// totalSale += pricePerItem * item.getAmount();
+// player.getInventory().remove(item);
+// }
+// }
+//
+// if (totalSale > 0) {
+// giveMoney(player, totalSale);
+// // We send the message of the amount earned in the giveMoney method now!!
+// //player.sendMessage(String.format("Sold items for $%.2f", totalSale));
+// } else {
+// //player.sendMessage("No eligible items to sell."); // For debug purposes only. Comment out when done.
+// }
+// }
+//
+// private void giveMoney(Player player, double amount) {
+// Economy economy = PrisonSetup.getEconomy();
+// economy.depositPlayer(player, amount);
+// player.sendMessage(ChatColor.translateAlternateColorCodes('&', String.format("&a&lYou've earned: $%.2f", amount)));
+// }
public boolean isSellable(Material material) {
return prices.containsKey(material);
diff --git a/src/main/java/me/nvus/nvus_prison_setup/Configs/ConfigManager.java b/src/main/java/me/nvus/nvus_prison_setup/Configs/ConfigManager.java
index 50c50a4..08690b7 100644
--- a/src/main/java/me/nvus/nvus_prison_setup/Configs/ConfigManager.java
+++ b/src/main/java/me/nvus/nvus_prison_setup/Configs/ConfigManager.java
@@ -8,6 +8,8 @@ import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
+import java.util.TreeMap;
+
public class ConfigManager {
private final JavaPlugin plugin;
@@ -86,6 +88,41 @@ public class ConfigManager {
itemPricesConfig = YamlConfiguration.loadConfiguration(file);
}
+ public void reorderItemPrices() {
+ File itemPricesFile = new File(getDataFolder(), "item_prices.yml");
+ FileConfiguration config = YamlConfiguration.loadConfiguration(itemPricesFile);
+ FileConfiguration newConfig = new YamlConfiguration();
+
+ // Using TreeMap to automatically sort the keys in natural order
+ Map sortedMap = new TreeMap<>();
+
+ // Assuming your structure is directly under the root
+ if (config.getConfigurationSection("Prices") != null) {
+ for (String key : config.getConfigurationSection("Prices").getKeys(false)) {
+ double price = config.getDouble("Prices." + key + ".Sell");
+ // Storing in a sorted map
+ sortedMap.put(key, price);
+ }
+
+ // Clear the existing "Prices" section
+ config.set("Prices", null);
+
+ // Repopulate the "Prices" section in sorted order
+ for (Map.Entry entry : sortedMap.entrySet()) {
+ config.set("Prices." + entry.getKey() + ".Sell", entry.getValue());
+ }
+
+ // Save the sorted configuration back to the file
+ try {
+ config.save(itemPricesFile);
+ System.out.println("Saved item_prices.yml with materials in alphabetical order.");
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.err.println("Failed to save item_prices.yml in alphabetical order.");
+ }
+ }
+ }
+
public FileConfiguration getItemPricesConfig() {
return itemPricesConfig;
}
diff --git a/src/main/java/me/nvus/nvus_prison_setup/Configs/SettingsMenu.java b/src/main/java/me/nvus/nvus_prison_setup/Configs/SettingsMenu.java
index a1fea39..48ef035 100644
--- a/src/main/java/me/nvus/nvus_prison_setup/Configs/SettingsMenu.java
+++ b/src/main/java/me/nvus/nvus_prison_setup/Configs/SettingsMenu.java
@@ -31,17 +31,23 @@ public class SettingsMenu implements Listener {
}
public void openSettingsMenu(Player player) {
- Inventory inv = Bukkit.createInventory(null, 9, ChatColor.DARK_GREEN + "NVus Prison Settings");
+ Inventory inv = Bukkit.createInventory(null, 18, ChatColor.DARK_GREEN + "NVus Prison Settings");
FileConfiguration config = configManager.getConfig("config.yml");
inv.setItem(0, createToggleItem(Material.LEATHER_CHESTPLATE, "Toggle PrisonerArmor", config.getBoolean("PrisonerArmor", true)));
inv.setItem(1, createToggleItem(Material.IRON_CHESTPLATE, "Toggle RestrictArmor", config.getBoolean("RestrictArmor", true)));
- inv.setItem(3, createToggleItem(Material.HOPPER, "Toggle AutoPickup", config.getBoolean("AutoPickup", true)));
- inv.setItem(4, createToggleItem(Material.LEVER, "Toggle AutoSwitch", config.getBoolean("AutoSwitch", false)));
+ inv.setItem(3, createToggleItem(Material.HOPPER, "Toggle AutoPickup", config.getBoolean("AutoPickup", false)));
+ inv.setItem(4, createToggleItem(Material.LEVER, "Toggle AutoSwitch", config.getBoolean("AutoSwitch", true)));
+ inv.setItem(5, createToggleItem(Material.IRON_PICKAXE, "Toggle ToolDamage", config.getBoolean("ToolDamage", false)));
- inv.setItem(6, createToggleItem(Material.IRON_PICKAXE, "Toggle ToolDamage", config.getBoolean("ToolDamage", false)));
- inv.setItem(7, createToggleItem(Material.BOOK, "Reload Configs", false));
+ inv.setItem(8, createToggleItem(Material.BOOK, "Reload Configs", false));
+
+ // Second Row
+ inv.setItem(9, createToggleItem(Material.GOLD_INGOT, "Toggle AutoSell", config.getBoolean("AutoSell", true)));
+ inv.setItem(10, createToggleItem(Material.GOLD_BLOCK, "Toggle SellAll", config.getBoolean("SellAll", true)));
+
+ inv.setItem(11, createToggleItem(Material.OAK_SAPLING, "Toggle TreeFarm", config.getBoolean("TreeFarm", true)));
player.openInventory(inv);
}
@@ -94,6 +100,12 @@ public class SettingsMenu implements Listener {
toggleConfigOption(player, "AutoPickup");
} else if (displayName.contains("Toggle AutoSwitch")) {
toggleConfigOption(player, "AutoSwitch");
+ } else if (displayName.contains("Toggle AutoSell")) {
+ toggleConfigOption(player, "AutoSell");
+ } else if (displayName.contains("Toggle SellAll")) {
+ toggleConfigOption(player, "SellAll");
+ } else if (displayName.contains("Toggle TreeFarm")) {
+ toggleConfigOption(player, "TreeFarm");
} else if (displayName.contains("Reload Configs")) {
reloadConfigs(player);
}
diff --git a/src/main/java/me/nvus/nvus_prison_setup/Listeners/CommandListener.java b/src/main/java/me/nvus/nvus_prison_setup/Listeners/CommandListener.java
index f136a23..7127790 100644
--- a/src/main/java/me/nvus/nvus_prison_setup/Listeners/CommandListener.java
+++ b/src/main/java/me/nvus/nvus_prison_setup/Listeners/CommandListener.java
@@ -104,6 +104,27 @@ public class CommandListener implements CommandExecutor {
}
handleToggleConfigCommand(sender, "ToolDamage", args[1]);
break;
+ case "treefarm": // New case for toggling RestrictArmor
+ if (args.length < 2) {
+ sender.sendMessage(ChatColor.RED + "Usage: /nvus treefarm ");
+ return true;
+ }
+ handleToggleConfigCommand(sender, "TreeFarm", args[1]);
+ break;
+ case "autosell": // New case for toggling RestrictArmor
+ if (args.length < 2) {
+ sender.sendMessage(ChatColor.RED + "Usage: /nvus autosell ");
+ return true;
+ }
+ handleToggleConfigCommand(sender, "AutoSell", args[1]);
+ break;
+ case "sellall": // New case for toggling RestrictArmor
+ if (args.length < 2) {
+ sender.sendMessage(ChatColor.RED + "Usage: /nvus sellall ");
+ return true;
+ }
+ handleToggleConfigCommand(sender, "SellAll", args[1]);
+ break;
default:
sender.sendMessage(ChatColor.RED + "Invalid command. Use /nvus for help.");
return true;
@@ -116,6 +137,7 @@ public class CommandListener implements CommandExecutor {
configManager.reloadConfig("config.yml");
configManager.reloadConfig("auto_switch.yml");
configManager.reloadConfig("banned_items.yml");
+ configManager.reloadConfig("item_prices.yml");
sender.sendMessage(ChatColor.GREEN + "Configuration files reloaded.");
}
diff --git a/src/main/java/me/nvus/nvus_prison_setup/PrisonSetup.java b/src/main/java/me/nvus/nvus_prison_setup/PrisonSetup.java
index 64f2e1d..522d016 100644
--- a/src/main/java/me/nvus/nvus_prison_setup/PrisonSetup.java
+++ b/src/main/java/me/nvus/nvus_prison_setup/PrisonSetup.java
@@ -14,6 +14,7 @@ import me.nvus.nvus_prison_setup.Updater.UpdateChecker;
import me.nvus.nvus_prison_setup.Listeners.ToolDamageListener;
import me.nvus.nvus_prison_setup.TreeFarm.TreeFarmListener;
import me.nvus.nvus_prison_setup.AutoSell.SellManager;
+import me.nvus.nvus_prison_setup.AutoSell.Listeners.AutoSellListener;
// Database
import me.nvus.nvus_prison_setup.Database.DatabaseManager;
// Gangs
@@ -72,6 +73,8 @@ public final class PrisonSetup extends JavaPlugin {
configManager.saveDefaultConfig("auto_switch.yml");
configManager.saveDefaultConfig("item_prices.yml");
+ configManager.loadItemPricesConfig(this.getDataFolder());
+
// Check if Vault is installed, it's a hard dependency so disable plugin if not installed!
if (!setupEconomy()) {
getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
@@ -79,8 +82,6 @@ public final class PrisonSetup extends JavaPlugin {
return;
}
- //FileConfiguration config = configManager.getConfig("config.yml");
-
// Register Event Listeners
getServer().getPluginManager().registerEvents(new PlayerSpawn(configManager), this);
getServer().getPluginManager().registerEvents(new PlayerArmor(configManager), this);
@@ -96,15 +97,20 @@ public final class PrisonSetup extends JavaPlugin {
new GangPlaceholders(gangManager).register();
}
+
+
// Register the Auto Sell and Sell All Listeners
boolean autoSellEnabled = configManager.getConfig("config.yml").getBoolean("AutoSell", true);
boolean sellAllEnabled = configManager.getConfig("config.yml").getBoolean("SellAll", true);
SellManager sellManager = new SellManager(configManager);
+ this.getCommand("setprice").setExecutor(sellManager);
// If they are true, register the commands.
if (autoSellEnabled) {
// Register the autosell command.
this.getCommand("autosell").setExecutor(sellManager);
+ // Register AutoSell Listener then too!
+ getServer().getPluginManager().registerEvents(new AutoSellListener(sellManager), this);
}
// If they are true, register the commands.
if (sellAllEnabled) {
@@ -120,7 +126,7 @@ public final class PrisonSetup extends JavaPlugin {
getServer().getPluginManager().registerEvents(toolDamageListener, this);
// TreeFarm Boolean Check
- if (configManager.getBoolean("config.yml", "TreeFarm", false)) {
+ if (configManager.getBoolean("config.yml", "TreeFarm", true)) {
getServer().getPluginManager().registerEvents(new TreeFarmListener(this), this);
}
@@ -130,13 +136,27 @@ public final class PrisonSetup extends JavaPlugin {
// UPDATE CHECKER
new UpdateChecker(this, 12345).getVersion(version -> {
if (!this.getDescription().getVersion().equals(version)) {
- getLogger().info("There is a new update available for NVus Prison Setup! Grab it from SpigotMC here: https://www.spigotmc.org/resources/nvus-prison-setup.115441/");
+ getLogger().info(" ");
+ getLogger().info("=====================================================");
+ getLogger().info(" ");
+ getLogger().info("An update for NVus Prison Lite is available! Grab it from:");
+ getLogger().info("SpigotMC: https://www.spigotmc.org/resources/nvus-prison-setup.115441/");
+ getLogger().info("BuiltByBit: https://builtbybit.com/resources/nvus-prison-lite.40514/");
+ getLogger().info(" ");
+ getLogger().info("=====================================================");
+ getLogger().info(" ");
Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.isOp() || player.hasPermission("nvus.admin")) {
+ player.sendMessage(ChatColor.RED + " ");
player.sendMessage(ChatColor.RED + "=====================================================");
- player.sendMessage(ChatColor.YELLOW + "An update for NVus Prison Setup is available! Grab it from SpigotMC here: https://www.spigotmc.org/resources/nvus-prison-setup.115441/");
+ player.sendMessage(ChatColor.RED + " ");
+ player.sendMessage(ChatColor.YELLOW + "An update for NVus Prison Lite is available! Grab it from:");
+ player.sendMessage(ChatColor.YELLOW + "SpigotMC: https://www.spigotmc.org/resources/nvus-prison-setup.115441/");
+ player.sendMessage(ChatColor.YELLOW + "BuiltByBit: https://builtbybit.com/resources/nvus-prison-lite.40514/");
+ player.sendMessage(ChatColor.RED + " ");
player.sendMessage(ChatColor.RED + "=====================================================");
+ player.sendMessage(ChatColor.RED + " ");
}
}
}, 20L * 60);
diff --git a/src/main/java/me/nvus/nvus_prison_setup/TreeFarm/TreeFarmListener.java b/src/main/java/me/nvus/nvus_prison_setup/TreeFarm/TreeFarmListener.java
index ef0e519..cba9408 100644
--- a/src/main/java/me/nvus/nvus_prison_setup/TreeFarm/TreeFarmListener.java
+++ b/src/main/java/me/nvus/nvus_prison_setup/TreeFarm/TreeFarmListener.java
@@ -17,12 +17,22 @@ public class TreeFarmListener implements Listener {
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
+
+ // Check if the block being broken is a sapling and protect it unless player has admin permission
+ if (block.getType() == Material.OAK_SAPLING || block.getType() == Material.SPRUCE_SAPLING || block.getType() == Material.BIRCH_SAPLING || block.getType() == Material.JUNGLE_SAPLING || block.getType() == Material.ACACIA_SAPLING || block.getType() == Material.DARK_OAK_SAPLING) {
+ if (!event.getPlayer().hasPermission("nvus.admin")) {
+ event.setCancelled(true);
+ event.getPlayer().sendMessage("§cYou do not have permission to break saplings!");
+ return;
+ }
+ }
+
// Check if the block being broken is a log
if (TreeType.isLog(block.getType())) {
// Get the block directly beneath the log block
Block blockBelow = block.getRelative(0, -1, 0);
// Check if the block below is either grass or dirt, indicating this could be the base of a tree
- if (blockBelow.getType() == Material.GRASS_BLOCK || blockBelow.getType() == Material.DIRT) {
+ if (blockBelow.getType() == Material.GRASS_BLOCK || blockBelow.getType() == Material.DIRT || blockBelow.getType() == Material.PODZOL || blockBelow.getType() == Material.MYCELIUM || (blockBelow.getType() == Material.SAND)) {
// Check if the player has the required permission
if (event.getPlayer().hasPermission("nvus.prisoner")) {
event.setCancelled(true); // Cancel the event to handle block breaking manually
diff --git a/src/main/resources/item_prices.yml b/src/main/resources/item_prices.yml
index d38714d..66fb09d 100644
--- a/src/main/resources/item_prices.yml
+++ b/src/main/resources/item_prices.yml
@@ -6,21 +6,21 @@
#======================================================================================#
Prices:
- - Material: OAK_PLANKS
+ OAK_PLANKS:
Sell: 1.0
- - Material: SPRUCE_PLANKS
+ SPRUCE_PLANKS:
Sell: 1.0
- - Material: BIRCH_PLANKS
+ BIRCH_PLANKS:
Sell: 1.0
- - Material: JUNGLE_PLANKS
+ JUNGLE_PLANKS:
Sell: 1.0
- - Material: ACACIA_PLANKS
+ ACACIA_PLANKS:
Sell: 1.0
- - Material: DARK_OAK_PLANKS
+ Dark_OAK_PLANKS:
Sell: 1.0
- - Material: Cobblestone
+ COBBLESTONE:
Sell: 1.0
- - Material: Stone
+ STONE:
Sell: 2.0
- - Material: Coal
- Sell: 0.50
\ No newline at end of file
+ COAL:
+ Sell: 1.5
\ No newline at end of file
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 8a60843..f6b1075 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -27,6 +27,8 @@ commands:
/nvus prisonerarmor - Toggles giving prisoners armor on join.
/nvus restrictarmor - Toggles the restriction on changing prisoner armor.
/nvus tooldamage - Toggle if prisoner tools receive damage. FALSE = No Damage.
+ /nvus autosell - Toggle if prisoners can auto toggle auto selling of items as they are mined.
+ /nvus sellall - Toggle if prisoners can use /sellall to manually sell items form inventory.
aliases: [prison]
gang:
@@ -52,4 +54,20 @@ commands:
description: Toggle auto selling all eligible items in your inventory.
usage: |
/autosell - Toggle auto selling all eligible items in your inventory.
- aliases: [ automaticsell ]
\ No newline at end of file
+ aliases: [ automaticsell ]
+ setprice:
+ description: Set the price of the block being held in item_prices.yml.
+ usage: |
+ /setprice - Set the price of the block being held in item_prices.yml.
+ aliases: [ setblockprice ]
+
+permissions:
+ nvus.admin:
+ description: Allows access to NVus Prison admin commands.
+ default: op
+ nvus.gang.create:
+ description: Allows creating a gang.
+ default: true
+ nvus.prisoner:
+ description: Allows access to NVus Prison prisoner features ie AutoSwitch,AutoSell,Restricting Armor etc.
+ default: true
\ No newline at end of file