mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-02 15:43:54 +01:00
admins can override ownership
This commit is contained in:
parent
c590a59644
commit
588cfff8cb
@ -92,7 +92,7 @@ public class EventListen implements Listener {
|
|||||||
if (!npcManager.isNPCSelectedByPlayer(player, npc)) {
|
if (!npcManager.isNPCSelectedByPlayer(player, npc)) {
|
||||||
if (player.getItemInHand().getTypeId() == Setting.SELECTION_ITEM.asInt()
|
if (player.getItemInHand().getTypeId() == Setting.SELECTION_ITEM.asInt()
|
||||||
&& (npc.getTrait(Owner.class).getOwner().equals(player.getName()) || player
|
&& (npc.getTrait(Owner.class).getOwner().equals(player.getName()) || player
|
||||||
.hasPermission("citizens.npc.override-selection"))) {
|
.hasPermission("citizens.admin"))) {
|
||||||
npcManager.selectNPC(player, npc);
|
npcManager.selectNPC(player, npc);
|
||||||
Messaging.sendWithNPC(player, Setting.SELECTION_MESSAGE.asString(), npc);
|
Messaging.sendWithNPC(player, Setting.SELECTION_MESSAGE.asString(), npc);
|
||||||
if (!Setting.QUICK_SELECT.asBoolean())
|
if (!Setting.QUICK_SELECT.asBoolean())
|
||||||
|
@ -118,7 +118,8 @@ public class CommandManager {
|
|||||||
if (cmdRequirements.selected() && npc == null)
|
if (cmdRequirements.selected() && npc == null)
|
||||||
throw new RequirementMissingException("You must have an NPC selected to execute that command.");
|
throw new RequirementMissingException("You must have an NPC selected to execute that command.");
|
||||||
if (cmdRequirements.ownership() && npc != null
|
if (cmdRequirements.ownership() && npc != null
|
||||||
&& !npc.getTrait(Owner.class).getOwner().equals(player.getName()))
|
&& !npc.getTrait(Owner.class).getOwner().equals(player.getName())
|
||||||
|
&& !player.hasPermission("citizens.admin"))
|
||||||
throw new RequirementMissingException("You must be the owner of this NPC to execute that command.");
|
throw new RequirementMissingException("You must be the owner of this NPC to execute that command.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user