mirror of
https://github.com/YouHaveTrouble/Stand-in.git
synced 2026-05-11 22:16:55 +00:00
add permissions
This commit is contained in:
@@ -2,14 +2,28 @@ package me.youhavetrouble.standin;
|
||||
|
||||
import me.youhavetrouble.standin.stand.StandinInteractionListener;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public final class StandIn extends JavaPlugin {
|
||||
|
||||
public static final NamespacedKey KEY = new NamespacedKey("stand-in", "stand-in");
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
getServer().getPluginManager().addPermissions(
|
||||
List.of(
|
||||
new Permission("standin.edit.armor_stand", PermissionDefault.OP),
|
||||
new Permission("standin.edit.mannequin", PermissionDefault.OP)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
getServer().getPluginManager().registerEvents(new StandinInteractionListener(), this);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class StandinInteractionListener implements Listener {
|
||||
if (entity == null) return false;
|
||||
if (!player.isOnline()) return false;
|
||||
|
||||
if (entity instanceof ArmorStand armorStand) {
|
||||
if (entity instanceof ArmorStand armorStand && player.hasPermission("standin.edit.armor_stand")) {
|
||||
StandinDialog.openArmorStandDialog(player, armorStand);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user