package com.github.dtschust.zork.types; import com.github.dtschust.zork.ZorkGame; import com.github.dtschust.zork.repl.ActionDispatcher; import java.util.List; public interface HasPrintsAndActions { List getPrints(); List getActions(); default void printAndExecuteActions(final ZorkGame game) { for (final String print : getPrints()) { game.stream.println(print); } final ActionDispatcher effectsDispatcher = new ActionDispatcher(game); for (final String action : getActions()) { effectsDispatcher.dispatch(action); } } }