Fix unloaded file check

This commit is contained in:
s809
2023-09-24 18:48:14 +05:00
parent ed2fca240e
commit 4fb9126d49
2 changed files with 5 additions and 9 deletions
@@ -38,13 +38,11 @@ import com.seibel.distanthorizons.core.util.FileUtil;
import com.seibel.distanthorizons.core.util.LodUtil;
import com.seibel.distanthorizons.core.util.ThreadUtil;
import org.apache.logging.log4j.Logger;
import com.seibel.distanthorizons.core.dataObjects.fullData.loader.AbstractFullDataSourceLoader;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
@@ -69,12 +67,12 @@ public class FullDataFileHandler implements IFullDataSourceProvider
{
map.put(pos,
loadedMetaFileBySectionPos.containsKey(pos) ? 3 // Loaded
: this.isFileUnloaded(pos) ? 2 // Unloaded
: 1); // Not generated
: this.fileExists(pos) ? 2 // Unloaded
: 1); // Not generated
}
return map;
}
protected boolean isFileUnloaded(DhSectionPos pos) { return !loadedMetaFileBySectionPos.containsKey(pos); }
protected boolean fileExists(DhSectionPos pos) { return this.computeDataFilePath(pos).exists(); }
protected final IDhLevel level;
protected final File saveDir;
@@ -19,7 +19,6 @@
package com.seibel.distanthorizons.core.file.fullDatafile;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.dataObjects.fullData.accessor.ChunkSizedFullDataAccessor;
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.CompleteFullDataSource;
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
@@ -30,7 +29,6 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.multiplayer.client.ClientNetworkState;
import com.seibel.distanthorizons.core.network.exceptions.InvalidLevelException;
import com.seibel.distanthorizons.core.network.exceptions.InvalidSectionPosException;
import com.seibel.distanthorizons.core.network.exceptions.RequestRejectedException;
import com.seibel.distanthorizons.core.network.messages.fullData.updates.FullDataChangeSummaryRequestMessage;
import com.seibel.distanthorizons.core.network.messages.fullData.updates.FullDataChangeSummaryResponseMessage;
import com.seibel.distanthorizons.core.pos.DhSectionPos;
@@ -145,7 +143,7 @@ public class RemoteFullDataFileHandler extends GeneratedFullDataFileHandler
@Override
public FullDataMetaFile getFileIfExist(DhSectionPos pos)
{
if (this.networkState == null || !this.isFileUnloaded(pos))
if (this.networkState == null || !this.fileExists(pos))
return super.getFileIfExist(pos);
if (!this.networkState.config.postRelogUpdateEnabled)
@@ -155,7 +153,7 @@ public class RemoteFullDataFileHandler extends GeneratedFullDataFileHandler
if (metaFile == null)
return null;
LOGGER.info("Checking server updates for section {}", pos);
LOGGER.debug("Checking server updates for section {}", pos);
pos.forEachChildAtLevel(DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL, childPos ->
{
FullDataMetaFile childMetaFile = super.getFileIfExist(childPos);