From 7ada9eab2906fe55c119ab79b8378fea3652bed1 Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Sat, 31 Dec 2022 15:03:09 +0100 Subject: [PATCH] permission for help command --- .../youhavetrouble/preventstabby/commands/HelpCommand.java | 6 ++++++ src/main/resources/plugin.yml | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/me/youhavetrouble/preventstabby/commands/HelpCommand.java b/src/main/java/me/youhavetrouble/preventstabby/commands/HelpCommand.java index 1608b25..d6ca936 100644 --- a/src/main/java/me/youhavetrouble/preventstabby/commands/HelpCommand.java +++ b/src/main/java/me/youhavetrouble/preventstabby/commands/HelpCommand.java @@ -10,6 +10,12 @@ import org.bukkit.command.CommandSender; public class HelpCommand { public static void help(CommandSender sender, String[] args) { Bukkit.getScheduler().runTaskAsynchronously(PreventStabby.getPlugin(), () -> { + + if (!PreventStabbyPermission.COMMAND_HELP.doesCommandSenderHave(sender)) { + PluginMessages.sendMessage(sender, PreventStabby.getPlugin().getConfigCache().getNo_permission()); + return; + } + Component helpComponent = PluginMessages.MINIMESSAGE .deserialize(" PreventStabby Help ") .append(Component.newline()) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index a27b31d..c91acd3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -22,6 +22,11 @@ permissions: preventstabby.command: default: true description: Allows usage of /pvp command + preventstabby.command.help: + default: true + description: Allows usage of /pvp help command + children: + preventstabby.command: true preventstabby.command.toggle: default: true description: Allows usage of /pvp command