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[] { "" };
}
}