mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-03-01 02:31:21 +01:00
Allow /npc spawn to use the selected NPC
This commit is contained in:
parent
96c8f0d86a
commit
ef8fe596a0
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user