package com.github.dtschust.zork.repl.actions; import com.github.dtschust.zork.ZorkGame; import com.github.dtschust.zork.repl.Action; import java.util.List; public class ReadAction implements Action { @Override public boolean matchesInput(List arguments) { return arguments.get(0).equals("read"); } @Override public int getMinimumArgCount() { return 2; } @Override public boolean run(ZorkGame game, List arguments) { return game.getItem(arguments.get(1)).map(i -> { game.stream.println(i.getWriting()); return true; }).orElse(false); } }