From 5087ffb4bfa15ed536b166b30e1548bbb88e7aa9 Mon Sep 17 00:00:00 2001 From: fullwall Date: Wed, 22 Feb 2023 23:17:16 +0800 Subject: [PATCH] Must be spawned for /npc equip --- .../main/java/net/citizensnpcs/commands/EditorCommands.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/src/main/java/net/citizensnpcs/commands/EditorCommands.java b/main/src/main/java/net/citizensnpcs/commands/EditorCommands.java index dcfa53a4a..9a714aa8d 100644 --- a/main/src/main/java/net/citizensnpcs/commands/EditorCommands.java +++ b/main/src/main/java/net/citizensnpcs/commands/EditorCommands.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Player; import net.citizensnpcs.api.command.Command; import net.citizensnpcs.api.command.CommandContext; import net.citizensnpcs.api.command.Requirements; +import net.citizensnpcs.api.command.exception.CommandException; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.editor.CopierEditor; import net.citizensnpcs.editor.Editor; @@ -35,7 +36,9 @@ public class EditorCommands { min = 1, max = 1, permission = "citizens.npc.edit.equip") - public void equip(CommandContext args, Player player, NPC npc) { + public void equip(CommandContext args, Player player, NPC npc) throws CommandException { + if (!npc.isSpawned()) + throw new CommandException("NPC must be spawned"); Editor.enterOrLeave(player, new EquipmentEditor(player, npc)); }