Minor cleanups
This commit is contained in:
parent
718e736032
commit
9564a205dc
8 changed files with 13 additions and 21 deletions
|
@ -19,6 +19,7 @@ import static com.github.dtschust.zork.Zork.Type.*;
|
|||
public class Zork {
|
||||
ZorkGame game;
|
||||
Scanner source = new Scanner(System.in);
|
||||
|
||||
public Zork(String filename) {
|
||||
|
||||
game = new ZorkReader(filename).build();
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.github.dtschust.zork;
|
|||
|
||||
/* Special Command condition */
|
||||
public class ZorkCommand {
|
||||
public final String commandName;
|
||||
private final String commandName;
|
||||
|
||||
public ZorkCommand(String command) {
|
||||
this.commandName = command;
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.github.dtschust.zork;
|
|||
|
||||
/* Generic condition*/
|
||||
public abstract class ZorkCondition {
|
||||
public final String object;
|
||||
protected final String object;
|
||||
|
||||
protected ZorkCondition(String object) {
|
||||
this.object = object;
|
||||
|
|
|
@ -10,13 +10,13 @@ import java.util.Set;
|
|||
public class ZorkGame {
|
||||
|
||||
public final Set<String> inventory = new HashSet<>();
|
||||
protected boolean running = false;
|
||||
protected String currentRoom;
|
||||
protected ZorkMap<ZorkRoom> rooms = new ZorkMap<>();
|
||||
protected ZorkMap<ZorkItem> items = new ZorkMap<>();
|
||||
protected ZorkMap<ZorkContainer> containers = new ZorkMap<>();
|
||||
protected ZorkMap<ZorkCreature> creatures = new ZorkMap<>();
|
||||
protected HashMap<String, Type> objectLookup = new HashMap<>();
|
||||
private final ZorkMap<ZorkRoom> rooms = new ZorkMap<>();
|
||||
private final ZorkMap<ZorkItem> items = new ZorkMap<>();
|
||||
private final ZorkMap<ZorkContainer> containers = new ZorkMap<>();
|
||||
private final ZorkMap<ZorkCreature> creatures = new ZorkMap<>();
|
||||
private final HashMap<String, Type> objectLookup = new HashMap<>();
|
||||
private boolean running = false;
|
||||
private String currentRoom;
|
||||
|
||||
public ZorkRoom getCurrentRoom() {
|
||||
return rooms.get(currentRoom);
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package com.github.dtschust.zork.parser;
|
||||
|
||||
import com.github.dtschust.zork.parser.dom.Elements;
|
||||
import org.w3c.dom.CharacterData;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public final class DOMUtils {
|
||||
private DOMUtils() {
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.w3c.dom.Node;
|
|||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.AbstractList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.RandomAccess;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.github.dtschust.zork.repl.actions;
|
|||
import com.github.dtschust.zork.ZorkGame;
|
||||
import com.github.dtschust.zork.repl.Action;
|
||||
import com.github.dtschust.zork.types.ZorkDirection;
|
||||
import com.github.dtschust.zork.types.ZorkRoom;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
|
|
@ -9,14 +9,6 @@ public enum ZorkDirection {
|
|||
SOUTH("south", "s"),
|
||||
WEST("west", "w");
|
||||
|
||||
public String getLongName() {
|
||||
return longName;
|
||||
}
|
||||
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
private final String longName;
|
||||
private final String shortName;
|
||||
|
||||
|
|
Reference in a new issue