/*
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.Item;
import server.Player;
import server.SyntaxException;

public class InventoryCommand extends Command {

    public InventoryCommand() {
        super(CommandCategory.GENERAL, "Shows your inventory.");
    }
    
    @Override
    public void run(Player player) throws SyntaxException {
        if (CommandProcessor.nextToken() != null) {
            throw new SyntaxException();
        }
        player.sendText(true, "@10FYou are carrying:");
        boolean gotOne = false;
        for (Item item : player.getInventory().getItems()) {
            player.sendText(false, "    " + item.getName(player, true));
            gotOne = true;
        }
        if (!gotOne) {
            player.sendText(false, "    nothing.");
        }
        player.sendResources();
    }

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

}