Skip to content

Commit 59d0295

Browse files
committed
permission stuff
1 parent af908f2 commit 59d0295

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<groupId>lol.hyper</groupId>
2525
<artifactId>toolstats</artifactId>
26-
<version>1.4.2</version>
26+
<version>1.4.3</version>
2727
<packaging>jar</packaging>
2828

2929
<name>ToolStats</name>

src/main/java/lol/hyper/toolstats/commands/CommandToolStats.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public CommandToolStats(ToolStats toolStats) {
4848

4949
@Override
5050
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
51-
if (!sender.hasPermission("toolstats.use")) {
51+
if (!sender.hasPermission("toolstats.command")) {
5252
audiences.sender(sender).sendMessage(Component.text("You do not have permission for this command.").color(NamedTextColor.RED));
5353
return true;
5454
}
@@ -67,7 +67,15 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
6767
return true;
6868
}
6969
case "reset": {
70+
if (!sender.hasPermission("toolstats.reset")) {
71+
audiences.sender(sender).sendMessage(Component.text("You do not have permission for this command.").color(NamedTextColor.RED));
72+
return true;
73+
}
7074
if (args.length == 2 && args[1].equalsIgnoreCase("confirm")) {
75+
if (!sender.hasPermission("toolstats.reset.confirm")) {
76+
audiences.sender(sender).sendMessage(Component.text("You do not have permission for this command.").color(NamedTextColor.RED));
77+
return true;
78+
}
7179
Player player = (Player) sender;
7280
ItemStack heldItem = player.getInventory().getItemInMainHand();
7381
if (heldItem.getType() == Material.AIR) {

src/main/resources/plugin.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ description: Track various tool stats!
77
commands:
88
toolstats:
99
usage: /toolstats
10-
description: Main command.
11-
permission: toolstats.main
10+
permission: toolstats.command
1211
permissions:
13-
toolstats.main:
14-
description: Allows the usage of /toolstats
12+
toolstats.command:
13+
description: Allows the usage of /toolstats.
1514
default: true
1615
toolstats.reload:
17-
description: Allows the usage of /toolstats reload
18-
default: op
16+
description: Allows the usage of /toolstats reload.
17+
default: op
18+
toolstats.reset:
19+
description: Allows the usage of /toolstats reset.
20+
default: true
21+
toolstats.reset.confirm:
22+
description: Allows the usage of /toolstats reset confirm.
23+
default: true

0 commit comments

Comments
 (0)