}
}
}
}
}else if(event.getMessage() instanceof MoveMessage){
MoveMessage msg = (MoveMessage)event.getMessage();
// Update the spaces
for(Location space : this.getSpaces()){
boolean isNewLoc = false;
boolean isOldLoc = false;
if(space.getLocationType()==LocationType.HALLWAY_TYPE){
if(msg.getOldLocation().getLocationType()==LocationType.HALLWAY_TYPE){
if(((Hallway)space).getHallwayName() == ((Hallway)msg.getOldLocation()).getHallwayName()){
isOldLoc = true;
}
}
if(msg.getNewLocation().getLocationType()==LocationType.HALLWAY_TYPE){
if(((Hallway)space).getHallwayName() == ((Hallway)msg.getNewLocation()).getHallwayName()){
isNewLoc = true;
}
}
}else if (space.getLocationType()==LocationType.ROOM_TYPE){
if(msg.getOldLocation().getLocationType()==LocationType.ROOM_TYPE){
if(((Room)space).getRoomName() == ((Room)msg.getOldLocation()).getRoomName()){
isOldLoc = true;
}
}
if(msg.getNewLocation().getLocationType()==LocationType.ROOM_TYPE){
if(((Room)space).getRoomName() == ((Room)msg.getNewLocation()).getRoomName()){
isNewLoc = true;
}
}
}
if(isOldLoc){
space.setCharacterName(null);
space.setPlayer(null);
}
if(isNewLoc){
space.setCharacterName(msg.getCharacterName());
// Now figure our which player should go there
for(Player player : this.players){
if(player.getCharacter() == msg.getCharacterName()){
space.setPlayer(player);
}
}
}
isOldLoc = false;