Adds a permission for usage, and updates to 1.19.2

This commit is contained in:
Kristian Knarvik 2022-10-03 00:11:39 +02:00
parent cbe5a9c02a
commit 7bf9e062a2
3 changed files with 14 additions and 2 deletions

View File

@ -46,7 +46,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.1-R0.1-SNAPSHOT</version>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -1,6 +1,7 @@
package net.knarcraft.blacksmith.listener;
import net.knarcraft.blacksmith.trait.BlacksmithTrait;
import net.knarcraft.blacksmith.util.MessageFormatter;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -20,6 +21,13 @@ public class NPCClickListener implements Listener {
//Perform any necessary pre-session work
Player player = event.getClicker();
//Permission check
if (!player.hasPermission("blacksmith.use")) {
MessageFormatter.displayErrorMessage(player, "You lack the necessary permission");
return;
}
if (!blacksmithTrait.prepareForSession(player)) {
return;
}

View File

@ -22,6 +22,10 @@ permissions:
default: op
children:
blacksmith.edit: true
blacksmith.use: true
blacksmith.edit:
description: Allows changing settings for the selected blacksmith NPC
default: op
default: op
blacksmith.use:
description: Allows the player to repair items using blacksmiths
default: true