diff --git a/README.MD b/README.MD index aad5e15..bc09ba9 100644 --- a/README.MD +++ b/README.MD @@ -1,41 +1,43 @@ -**NVus Prison Gold Edition** +## 🔗 Useful Stuff +Author(s): [@never2nv](https://git.fngnation.net/never2nv) +| [Documentation](https://www.spigotmc.org/resources/nvus-prison-lite.115441/field?field=documentation) + +![portfolio](https://img.shields.io/badge/my_portfolio-000?style=for-the-badge&logo=ko-fi&logoColor=white) + +# NVus Prison (GOLD EDITION) + +Useful features for Minecraft Prison Servers & Then Some :P -**Main Features:** -- Most features can be toggled on or off. -- Spawn prisoners in a prison jumpsuit (orange leather armor). -- Restrict prisoners from changing their armor. -- Added restricted items to a banned_items.yml file to restrict them being used, crafted or even transfered to storage. -- Enable AutoPickup for prisoners when they mine/dig blocks. -- Enable AutoSwitch for prisoners to auto switch to the correct tool when mining/digging. + +## Features +![NVus Prison Lite Info](https://git.fngnation.net/never2nv/NVus_Prison_Lite/raw/branch/main/assets/plugin_info.png) + +Currently, the plugin implements the following features, so far: + +- Equips orange leather armor to all prisoners. It also prevents prisoners from changing or equipping any other armor. + +- It generates a banned_items.yml file which can be configured to ban certain items for prisoners. Banned items cannot be used, equipped in hand, transferred to storage or even crafted by prisoners. + +- Adds a toggle in the config.yml to turn on/off AutoPickup for prisoners to automatically pickup mined resource drops (if they have enough room in their inventory for the drop(s)). + +- Adds a toggle in the config.yml for AutoSwitch, when set to true it allows server admins to customize the auto_switch.yml which will list what type of tools prisoners can auto switch to and what materials will trigger the auto switch to certain tools. Mining stone then prisoners hit clay? It will auto switch to the proper tool, if they have it in their inventory! + +- You can now toggle PrisonerArmor and RestrictArmor options in the main config.yml file. Turning off PrisonerArmor will of course not give any prisoners the default orange leather armor. Turning off RestrictArmor will allow prisoners to change/remove their armor + . +- PrisonerTools: You can select which tool(s) are considered "Prisoner Tools" these tools are used for the auto switch and tool damage features. + +- You can toggle ToolDamage. Setting to FALSE will prevent prisoner tools from being damaged when prisoners use them for mining etc! + +- Commands for admins to use in-game to toggle certain features on/off, reload the configs and check plugin version. + +- /nvus menu will now open an easy GUI Menu to toggle options on/off + +- Armor is still craftable by prisoners. We felt this to be a cool roleplay element like allowing prisoners to craft and sell armor in the prison shops. Almost like the age ol' prisoners creating license plates! HAHA. If you don't like this you can always add various types of armor to the banned_items.yml file ie IRON_HELMET, DIAMOND_CHESTPLATE etc -**Permissions:** -- To enable the prisoner features players who are considered prisoners should have the permission nvus.prisoner. -- Just in case, all non-prisoners and players who are no longer considered a prisoner should have the permission nvus.prisoner NEGATED. +## Documentation -The permission nvus.admin is needed for all in-game commands! +[Documentation](https://www.spigotmc.org/resources/nvus-prison-lite.115441/field?field=documentation) - -**Commands:** -These commands require the permission ' nvus.admin ' - - /nvus reload - Reload the config files if changed externally like adding additional banned items or materials to the auto switch list etc. - - /nvus version - Shows the current plugin version number. - - /nvus autopickup true|false - Toggle auto pickup for all prisoners on the server. - - /nvus autoswitch true|false - Toggle auto switching of tools for all prisoners on the server. - - /nvus prisonerarmor true|false - Toggle if prisoners are given the default prisoner armor (orange leather armor set). - - /nvus restrictarmor true|false - Toggle if prisoners can change/remove their armor. - - -**Needs Implemented:** -- Prison Gangs -- Prevent Prisoner Tool Damage -- Prison Credits -- Prison Mines 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 e41662c..9921ad5 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 @@ -34,12 +34,14 @@ public class SettingsMenu implements Listener { Inventory inv = Bukkit.createInventory(null, 9, ChatColor.DARK_GREEN + "NVus Prison Settings"); FileConfiguration config = configManager.getConfig("config.yml"); - // Adjust the items to be spaced out and include ToolDamage toggle - inv.setItem(0, createToggleItem(Material.LEATHER_CHESTPLATE, "Toggle PrisonerArmor", config.getBoolean("PrisonerArmor", false))); - inv.setItem(2, createToggleItem(Material.IRON_DOOR, "Toggle RestrictArmor", config.getBoolean("RestrictArmor", false))); - inv.setItem(4, createToggleItem(Material.HOPPER, "Toggle AutoPickup", config.getBoolean("AutoPickup", false))); - inv.setItem(6, createToggleItem(Material.LEVER, "Toggle AutoSwitch", config.getBoolean("AutoSwitch", false))); - inv.setItem(8, createToggleItem(Material.IRON_PICKAXE, "Toggle ToolDamage", config.getBoolean("ToolDamage", true))); + 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(6, createToggleItem(Material.IRON_PICKAXE, "Toggle ToolDamage", config.getBoolean("ToolDamage", false))); + inv.setItem(7, createToggleItem(Material.BOOK, "Reload Configs", false)); player.openInventory(inv); } @@ -47,20 +49,18 @@ public class SettingsMenu implements Listener { private ItemStack createToggleItem(Material material, String name, boolean isEnabled) { ItemStack item = new ItemStack(material); ItemMeta meta = item.getItemMeta(); - meta.setDisplayName(ChatColor.GREEN + name + ": " + (isEnabled ? ChatColor.BLUE + "Enabled" : ChatColor.RED + "Disabled")); + // Non-Toggable Items + if (name.equals("Reload Configs")) { + meta.setDisplayName(ChatColor.GREEN + name); + } + // Toggable Items + else { + meta.setDisplayName(ChatColor.GREEN + name + ": " + (isEnabled ? ChatColor.BLUE + "Enabled" : ChatColor.RED + "Disabled")); + } item.setItemMeta(meta); return item; } -// private ItemStack createItem(Material material, String name) { -// ItemStack item = new ItemStack(material); -// ItemMeta meta = item.getItemMeta(); -// meta.setDisplayName(name); -// item.setItemMeta(meta); -// return item; -// } - - @EventHandler public void onInventoryClick(InventoryClickEvent event) { if (!event.getView().getTitle().equals(ChatColor.DARK_GREEN + "NVus Prison Settings")) return; @@ -97,6 +97,7 @@ public class SettingsMenu implements Listener { } else if (displayName.contains("Reload Configs")) { reloadConfigs(player); } + }; playerTasks.put(playerUUID, task); @@ -127,5 +128,6 @@ public class SettingsMenu implements Listener { configManager.reloadConfig("banned_items.yml"); configManager.saveConfig("config.yml"); player.sendMessage(ChatColor.GREEN + "Configuration files reloaded."); + player.closeInventory(); } }