/*
Copyright (C) 2005 David Green <green@couchpotato.net>
All Rights Reserved.

This file is part of Aelfengard.

Aelfengard is proprietary software. You may not redistribute it without
prior written permission from the copyright holder.
*/

package server.command;

import server.Living;
import server.Player;
import server.SyntaxException;

public class KillCommand extends Command {

    public KillCommand() {
        super(CommandCategory.COMBAT, "Attacks a player or NPC.");
    }

    @Override
    public void run(Player player) throws SyntaxException {
        String name = CommandProcessor.nextToken();
        if (name == null || CommandProcessor.nextToken() != null) {
            throw new SyntaxException();
        }
        Living target = player.matchLocalLiving(name);
        if (target == null) {
            player.sendText(true, "There's noone here by that name.");
            return;
        }
        player.addHate(target);
    }

    @Override
    public String[] getSyntax(Player player) {
        return new String[] { "<who>" };
    }

}