diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/commands/CreateCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/commands/CreateCommand.java index 1c3c1e9..341edca 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/commands/CreateCommand.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/commands/CreateCommand.java @@ -26,12 +26,18 @@ public class CreateCommand implements CommandHandler { @Override public void run(CommandContext context) throws CommandExecutionException { - context.setUsage(context.getLabel() + " create "); + context.setUsage(context.getLabel() + " create []"); Player player = context.ensureSenderIsPlayer(); String id = context.popString(); if (npcRegistry.getById(id) != null) context.halt(Component.text("NPC with that ID already exists.", NamedTextColor.RED)); - NpcTypeImpl type = context.parse(NpcTypeImpl.class); + + NpcTypeImpl type; + if (context.argSize() == 1) { + type = context.parse(NpcTypeImpl.class); + } else { + type = typeRegistry.getByName("player"); + } NpcEntryImpl entry = npcRegistry.create(id, player.getWorld(), type, new NpcLocation(player.getLocation())); entry.enableEverything(); diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/commands/ToggleCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/commands/ToggleCommand.java index 764f771..4b122d6 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/commands/ToggleCommand.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/commands/ToggleCommand.java @@ -11,7 +11,6 @@ import net.kyori.adventure.text.format.NamedTextColor; import java.util.Collections; import java.util.List; -import java.util.Set; public class ToggleCommand implements CommandHandler { private final NpcRegistryImpl npcRegistry;