Enforce controllable permission for players

This commit is contained in:
fullwall 2023-07-08 21:40:32 +08:00
parent c0be235538
commit 94a798ca45

View File

@ -88,9 +88,14 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
}
return;
}
if (ownerRequired && !npc.getOrAddTrait(Owner.class).isOwnedBy(player)) {
if (!player.hasPermission(
"citizens.npc.controllable." + npc.getEntity().getType().name().toLowerCase().replace("_", ""))
|| !player.hasPermission("citizens.npc.controllable"))
return;
}
if (ownerRequired && !npc.getOrAddTrait(Owner.class).isOwnedBy(player))
return;
NMS.mount(npc.getEntity(), player);
}