permission stuff

This commit is contained in:
hyperdefined
2022-08-15 11:51:23 -04:00
parent af908f2eb6
commit 59d0295b18
3 changed files with 21 additions and 8 deletions

View File

@@ -23,7 +23,7 @@
<groupId>lol.hyper</groupId>
<artifactId>toolstats</artifactId>
<version>1.4.2</version>
<version>1.4.3</version>
<packaging>jar</packaging>
<name>ToolStats</name>

View File

@@ -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) {

View File

@@ -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
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