admins can override ownership

This commit is contained in:
aPunch 2012-02-19 11:07:19 -06:00
parent c590a59644
commit 588cfff8cb
2 changed files with 3 additions and 2 deletions

View File

@ -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())

View File

@ -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.");
} }
} }