23 lines
623 B
Java
23 lines
623 B
Java
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<String> getPrints();
|
|
|
|
List<String> 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);
|
|
}
|
|
}
|
|
}
|