Allow /npc spawn to use the selected NPC

This commit is contained in:
fullwall 2013-05-15 12:00:27 +08:00
parent 96c8f0d86a
commit ef8fe596a0

View File

@ -922,15 +922,15 @@ public class NPCCommands {
@Command(
aliases = { "npc" },
usage = "spawn [id]",
usage = "spawn (id)",
desc = "Spawn an existing NPC",
modifiers = { "spawn" },
min = 2,
min = 1,
max = 2,
permission = "citizens.npc.spawn")
@Requirements(ownership = true)
public void spawn(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
NPC respawn = npcRegistry.getById(args.getInteger(1));
NPC respawn = args.argsLength() > 1 ? npcRegistry.getById(args.getInteger(1)) : npc;
if (respawn == null)
throw new CommandException(Messages.NO_NPC_WITH_ID_FOUND, args.getInteger(1));
if (respawn.isSpawned())