diff --git a/README.md b/README.md index 9e281a3..c319708 100644 --- a/README.md +++ b/README.md @@ -1 +1,37 @@ -# PluginsControl \ No newline at end of file +# PluginsControl + +## Description + +This plugin allows you to control which plugins have to be enabled for the server continues running. + +## Installation + +1. Download the plugin from [here]( +2. Put the plugin in the `plugins` folder of your server. +3. Restart the server. +4. Add plugins to the list with `/pluginscontrol add `. +5. Enable the plugin with `/pluginscontrol enable`. + +## Configuration + +| Option | Description | +|-----------|-------------------------------------------------------| +| `enabled` | Whether the plugin is enabled or not. | +| `plugins` | List of plugins to be enabled when the server starts. | + +## Commands + +| Command | Sub Command | Description | +|--------------------------------|-------------------|----------------------------------| +| `/pluginscontrol \| plcontrol` | `add ` | Add a plugin to the list. | +| `/pluginscontrol \| plcontrol` | `remove ` | Remove a plugin from the list. | +| `/pluginscontrol \| plcontrol` | `enable \| on` | Enable PluginControl. | +| `/pluginscontrol \| plcontrol` | `disable \| off` | Disable PluginControl. | +| `/pluginscontrol \| plcontrol` | `toggle` | Enable or disable PluginControl. | +| `/pluginscontrol \| plcontrol` | `list` | List all plugins in the list. | + +## Permissions + +| Permissions | Description | +|----------------------|------------------------------------| +| `pluginscontrol.use` | Permission to use all [[commands]] | \ No newline at end of file diff --git a/src/main/java/com/armamc/plugincontrol/commands/Command.java b/src/main/java/com/armamc/plugincontrol/commands/Command.java index 25de4ab..7026bea 100644 --- a/src/main/java/com/armamc/plugincontrol/commands/Command.java +++ b/src/main/java/com/armamc/plugincontrol/commands/Command.java @@ -32,7 +32,7 @@ public boolean onCommand(@NotNull CommandSender sender, org.bukkit.command.@NotN } case "disable", "off" -> { Config.setEnabled(false); - sender.sendMessage(Component.text("[PluginControl] Desativado funcionalidades do plugin...") + sender.sendMessage(Component.text("[PluginControl] Desativando funcionalidades do plugin...") .color(NamedTextColor.GREEN)); return true; } @@ -43,12 +43,16 @@ public boolean onCommand(@NotNull CommandSender sender, org.bukkit.command.@NotN sender.sendMessage(Component.text("[PluginControl] Ativando funcionalidades do plugin...") .color(NamedTextColor.GREEN)); } else { - sender.sendMessage(Component.text("[PluginControl] Desativado funcionalidades do plugin...") + sender.sendMessage(Component.text("[PluginControl] Desativando funcionalidades do plugin...") .color(NamedTextColor.GREEN)); } return true; } case "add" -> { + if (args.length < 2 || args[1].isBlank() || args.length >= 3) { + sender.sendMessage(Component.text("[PluginControl] Use /plugincontrol add ").color(NamedTextColor.RED)); + return true; + } if (Config.addPlugin(args[1])) { sender.sendMessage(Component.text(MessageFormat.format("[PluginControl] Plugin {0} adicionado!", args[1])) .color(NamedTextColor.GREEN)); @@ -59,6 +63,14 @@ public boolean onCommand(@NotNull CommandSender sender, org.bukkit.command.@NotN return true; } case "remove" -> { + if (Config.getPluginList().isEmpty()) { + sender.sendMessage(Component.text("[PluginControl] Nenhum plugin adicionado!").color(NamedTextColor.RED)); + return true; + } + if (args.length < 2 || args[1].isBlank() || args.length >= 3) { + sender.sendMessage(Component.text("[PluginControl] Use /plugincontrol remove ").color(NamedTextColor.RED)); + return true; + } if (Config.removePlugin(args[1])) { sender.sendMessage(Component.text("[PluginControl] Plugin " + args[1] + " removido!").color(NamedTextColor.GREEN)); } else { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 88947c8..94330bd 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -8,7 +8,7 @@ website: https://armnamc.com commands: plugincontrol: description: "Command to manage PluginControl" - usage: "/ " + usage: "/ | " aliases: [pc, plcontrol] permission: plugincontrol.use permission-message: "You do not have permission to use this command" \ No newline at end of file