From cfcd046d4e1d2fd577c183edeaf0f7aa279d5bed Mon Sep 17 00:00:00 2001 From: fullwall Date: Sat, 3 Aug 2013 20:57:56 +0800 Subject: [PATCH] Allow /npc remove to be used by the server --- src/main/java/net/citizensnpcs/commands/NPCCommands.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/citizensnpcs/commands/NPCCommands.java b/src/main/java/net/citizensnpcs/commands/NPCCommands.java index 32b53e2cc..af1ce2c7c 100644 --- a/src/main/java/net/citizensnpcs/commands/NPCCommands.java +++ b/src/main/java/net/citizensnpcs/commands/NPCCommands.java @@ -895,17 +895,14 @@ public class NPCCommands { Messaging.sendTr(sender, Messages.REMOVED_ALL_NPCS); return; } - if (!(sender instanceof Player)) - throw new CommandException(Messages.COMMAND_MUST_BE_INGAME); - Player player = (Player) sender; if (npc == null) throw new CommandException(Messages.COMMAND_MUST_HAVE_SELECTED); - if (!npc.getTrait(Owner.class).isOwnedBy(player)) + if (!npc.getTrait(Owner.class).isOwnedBy(sender)) throw new CommandException(Messages.COMMAND_MUST_BE_OWNER); - if (!player.hasPermission("citizens.npc.remove") && !player.hasPermission("citizens.admin")) + if (!sender.hasPermission("citizens.npc.remove") && !sender.hasPermission("citizens.admin")) throw new NoPermissionsException(); npc.destroy(); - Messaging.sendTr(player, Messages.NPC_REMOVED, npc.getName()); + Messaging.sendTr(sender, Messages.NPC_REMOVED, npc.getName()); } @Command(