mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-24 03:25:13 +01:00
Allow /npc remove to be used by the server
This commit is contained in:
parent
d568dfb886
commit
cfcd046d4e
@ -895,17 +895,14 @@ public class NPCCommands {
|
|||||||
Messaging.sendTr(sender, Messages.REMOVED_ALL_NPCS);
|
Messaging.sendTr(sender, Messages.REMOVED_ALL_NPCS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(sender instanceof Player))
|
|
||||||
throw new CommandException(Messages.COMMAND_MUST_BE_INGAME);
|
|
||||||
Player player = (Player) sender;
|
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
throw new CommandException(Messages.COMMAND_MUST_HAVE_SELECTED);
|
throw new CommandException(Messages.COMMAND_MUST_HAVE_SELECTED);
|
||||||
if (!npc.getTrait(Owner.class).isOwnedBy(player))
|
if (!npc.getTrait(Owner.class).isOwnedBy(sender))
|
||||||
throw new CommandException(Messages.COMMAND_MUST_BE_OWNER);
|
throw new CommandException(Messages.COMMAND_MUST_BE_OWNER);
|
||||||
if (!player.hasPermission("citizens.npc.remove") && !player.hasPermission("citizens.admin"))
|
if (!sender.hasPermission("citizens.npc.remove") && !sender.hasPermission("citizens.admin"))
|
||||||
throw new NoPermissionsException();
|
throw new NoPermissionsException();
|
||||||
npc.destroy();
|
npc.destroy();
|
||||||
Messaging.sendTr(player, Messages.NPC_REMOVED, npc.getName());
|
Messaging.sendTr(sender, Messages.NPC_REMOVED, npc.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
|
Loading…
Reference in New Issue
Block a user