function onMapListModified($curMapIndex, $nextMapIndex, $isListModified) { if ($isListModified) { $maps = $this->connection->getMapList(-1, 0); foreach ($maps as $key => $map) { $storageKey = array_search($map, $this->maps); if ($storageKey !== false) { $maps[$key] = $this->maps[$storageKey]; } else { $this->maps[$storageKey] = null; } } $this->maps = $maps; } $this->nextMap = isset($this->maps[$nextMapIndex]) ? $this->maps[$nextMapIndex] : null; }