From 59d0295b18e4def38edff7f160dc3bee9c142eff Mon Sep 17 00:00:00 2001 From: hyperdefined Date: Mon, 15 Aug 2022 11:51:23 -0400 Subject: [PATCH] permission stuff --- pom.xml | 2 +- .../toolstats/commands/CommandToolStats.java | 10 +++++++++- src/main/resources/plugin.yml | 17 +++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 3420979..a33833c 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ lol.hyper toolstats - 1.4.2 + 1.4.3 jar ToolStats diff --git a/src/main/java/lol/hyper/toolstats/commands/CommandToolStats.java b/src/main/java/lol/hyper/toolstats/commands/CommandToolStats.java index b34d3ae..a1c040f 100644 --- a/src/main/java/lol/hyper/toolstats/commands/CommandToolStats.java +++ b/src/main/java/lol/hyper/toolstats/commands/CommandToolStats.java @@ -48,7 +48,7 @@ public class CommandToolStats implements TabExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { - if (!sender.hasPermission("toolstats.use")) { + if (!sender.hasPermission("toolstats.command")) { audiences.sender(sender).sendMessage(Component.text("You do not have permission for this command.").color(NamedTextColor.RED)); return true; } @@ -67,7 +67,15 @@ public class CommandToolStats implements TabExecutor { return true; } case "reset": { + if (!sender.hasPermission("toolstats.reset")) { + audiences.sender(sender).sendMessage(Component.text("You do not have permission for this command.").color(NamedTextColor.RED)); + return true; + } if (args.length == 2 && args[1].equalsIgnoreCase("confirm")) { + if (!sender.hasPermission("toolstats.reset.confirm")) { + audiences.sender(sender).sendMessage(Component.text("You do not have permission for this command.").color(NamedTextColor.RED)); + return true; + } Player player = (Player) sender; ItemStack heldItem = player.getInventory().getItemInMainHand(); if (heldItem.getType() == Material.AIR) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8e150cf..c735881 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -7,12 +7,17 @@ description: Track various tool stats! commands: toolstats: usage: /toolstats - description: Main command. - permission: toolstats.main + permission: toolstats.command permissions: - toolstats.main: - description: Allows the usage of /toolstats + toolstats.command: + description: Allows the usage of /toolstats. default: true toolstats.reload: - description: Allows the usage of /toolstats reload - default: op \ No newline at end of file + description: Allows the usage of /toolstats reload. + default: op + toolstats.reset: + description: Allows the usage of /toolstats reset. + default: true + toolstats.reset.confirm: + description: Allows the usage of /toolstats reset confirm. + default: true \ No newline at end of file