diff --git a/src/main/java/me/night/nullvalkyrie/commands/CommandManager.java b/src/main/java/me/night/nullvalkyrie/commands/CommandManager.java index 11f14b4..1524fd5 100644 --- a/src/main/java/me/night/nullvalkyrie/commands/CommandManager.java +++ b/src/main/java/me/night/nullvalkyrie/commands/CommandManager.java @@ -18,5 +18,6 @@ public class CommandManager { new BetaCommand(); new MinerCommand(); new LuckyDrawCommand(); + new NPCCommand(); } } diff --git a/src/main/java/me/night/nullvalkyrie/commands/NPCCommand.java b/src/main/java/me/night/nullvalkyrie/commands/NPCCommand.java new file mode 100644 index 0000000..0aba081 --- /dev/null +++ b/src/main/java/me/night/nullvalkyrie/commands/NPCCommand.java @@ -0,0 +1,39 @@ +package me.night.nullvalkyrie.commands; + +import me.night.nullvalkyrie.entities.npcs.NPCManager; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.util.StringUtil; + +import java.util.ArrayList; +import java.util.List; + +public class NPCCommand extends Command { + public NPCCommand() { + super("npc", new String[]{}, "NPCs", ""); + } + + @Override + public void onCommand(CommandSender sender, String[] args) { + if (sender instanceof Player player) { + if (args.length == 0) { + player.sendMessage(ChatColor.RED + "Invalid command"); + return; + } + if (args[0].equalsIgnoreCase("new")) { + NPCManager.createNPC(player, args[1]); + } + } + + } + + @Override + public List onTabComplete(CommandSender sender, String[] args) { + if (args.length == 1) { + List cc = List.of("new", "list"); + return StringUtil.copyPartialMatches(args[0], cc, new ArrayList<>()); + } + return new ArrayList<>(); + } +}